[CentOS] sed question

Alice Wonder
2015-08-25T18:21:37Z

On 08/25/2015 11:02 AM, Gordon Messmer wrote:

>
> Additionally, you can avoid using "cat" to make the script more
> efficient.  You'll start fewer processes, and complete more quickly.
cat
> is almost never needed unless you actually need to con"cat"enate
> multiple files.

I sometimes like to use cat purely for stylistic reasons :

cat file.txt |\
    sed -e s?"foo"?"bar"?g |\
    sed -e s?"dirty"?"clean?" |\
    > file2.txt

It lets me line up my sed expressions.

But yes, that is wasting a process for easier visualization. Worth it to me.