Sujet : Re: a sed question
De : gazelle (at) *nospam* shell.xmission.com (Kenny McCormack)
Groupes : comp.unix.shellDate : 20. Dec 2024, 13:44:48
Autres entêtes
Organisation : The official candy of the new Millennium
Message-ID : <vk3orv$1ut71$1@news.xmission.com>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
lsjtj8F2r8aU1@mid.individual.net>,
Salvador Mirzo wrote:
...
$ sed '/^x/{c\
hello a\
hi }' x.txt a line hello hi more lines more lines $
$ sed '/^x/{c\
hello
a\
hi
}' x.txt
Isn't this about the time where we give the caution about "Don't use sed
for anything beyond the s/foo/bar/g stage" ?
Seriously, the above looks like gobbledegook compared to the equivalent in
AWK (or some other normal scripting langugae). "sed" looks like Intercal
(once you get beyond s/foo/bar/g).
I'm sure that whatever it is that OP is trying to do, it could be easily
translated to (say) AWK and look much nicer.
-- The whole aim of practical politics is to keep the populace alarmed (and hence clamorousto be led to safety) by menacing it with an endless series of hobgoblins, all of them imaginary.H. L. Mencken