Re: sed question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux