On Sun, 1 Sep 2019 at 00:39, The Wanderer <wande...@fastmail.fm> wrote: > On 2019-08-31 at 10:07, Roberto C. Sánchez wrote: > > On Sat, Aug 31, 2019 at 09:26:49AM -0400, The Wanderer wrote: > >> On 2019-08-31 at 09:02, Roberto C. Sánchez wrote: > >> > >>> The only time you need to change the syntax is to add something > >>> before sed. But then, that's why shells have I/O redirection: > >>> > >>> (sed 's/config=.*$/config=/g' | tr -d '=') <~/test.txt > >>>> ~/other_test.txt > >> > >> This is *far* more complicated and messy, both syntactically and to > >> type in, than just having cat at the beginning of a pipeline. > >> > > That's quite a stretch. > > > > Your way: > > > > cat ~/test.txt | sed 's/config=.*$/config=/g' | tr -d '=' > > >~/other_test.txt > > > > A better way: > > > > (sed 's/config=.*$/config=/g' | tr -d '=') <~/test.txt > > >~/other_test.txt
[...] > I think this is a case of minds working differently. [...] > In that case, I fail to see the benefit. As far as I can tell, saving a > process is the entire sum-total benefit of avoiding the use of cat in > this type of context. For readers interested in this topic, here's a thorough coverage of many aspects of it: http://mywiki.wooledge.org/BashFAQ/119 http://mywiki.wooledge.org/BashPitfalls#cat_file_.7C_sed_s.2Ffoo.2Fbar.2F_.3E_file https://backreference.org/2011/01/29/in-place-editing-of-files/ http://mywiki.wooledge.org/BashFAQ/021