[2013-04-03 16:25] Sam Watkins <s...@nipl.net> > > using awk this seems to work: > > awk '{ gsub(A, B); print; }' A="$A" B="$B" > > Still a bit long, but much better than I can manage in sed or perl. Not sure > if that is standard awk or not, there's also a -v option to set values.
Your version is the original one, newer implementations and POSIX use -v. (However the last example on the POSIX page misses the -v.) http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html Btw, as you wanted it short: awk '{gsub(A,B)}1' A="$A" B="$B" meillo