On Fri, Jun 04, 2004 at 04:05:43PM -0700, Foo Lim wrote: > > Use perl. =D You can edit the file in place also: > > perl -p -i -e 's/(some regex)\r(some other regex)/${1}X${2}/' test.dat Unless you are absolutely sure of what you are doing (or you want to play around first), I'd use: perl -pi.bk -e ...