Re:Introduction to sed
by there on Friday October 07, 2011 @02:48PM
(#3085333)
however, perl has -i, which not all seds do, so those 0.002 seconds you lost to perl will be more than gained by being able to type
instead of
[ Parent
| on HN ]
Re:Introduction to sed
by telemachos on Friday October 07, 2011 @06:46PM
(#3086311)
Rather than -i alone, I always use -i.bak (or whatever you prefer instead of '.bak'). That way, you get (1) in-place editing and (2) a backup. The files you work on are backed up to "file.bak", so that if you make some simple regex mistake with huge negative consequences, you have a ready fix. (And if you do things perfectly, it's easy to run "rm *bak" after you confirm that.)
Re:Introduction to sed
by burgerbrain on Friday October 07, 2011 @05:57PM
(#3086175)
The utility 'sponge' is useful for doing this in the general case.
Re:Introduction to sed
by AlecSchueler on Friday October 07, 2011 @09:16PM
(#3086696)
Part of the 'moreutils' package, for the curious. The description for sponge on the project homepage reads "soak up standard input and write to a file."
Sed has -i, too! Well, at least GNU sed.
yes, that's why i said "not all seds".
missed it. sorry!
Re:Introduction to sed
by dramaticus3 on Saturday October 08, 2011 @07:26AM
(#3087683)
because GNU is Not Unix