[CentOS] sed question

Tue Aug 25 18:34:20 UTC 2015
Gordon Messmer <gordon.messmer at gmail.com>

On 08/25/2015 11:21 AM, Alice Wonder wrote:
>
> cat file.txt |\
>    sed -e s?"foo"?"bar"?g |\
>    sed -e s?"dirty"?"clean?" |\
>    > file2.txt 

I don't understand why you'd quote that way.  Though unlikely, you could 
potentially match a filename in the working directory, and hose the sed 
command.  For efficiency's sake, you can eliminate cat and one of the 
two sed processes, and still have a more readable command:

sed -e 's?foo?bar?g' \
     -e 's?dirty?clean?' \
     < file.txt > file2.txt