[ale] sed
James P. Kinney III
jkinney at localnetsolutions.com
Thu May 17 22:45:46 EDT 2007
On Thu, 2007-05-17 at 22:39 -0400, Jim Popovitch wrote:
> On Thu, 2007-05-17 at 22:34 -0400, James P. Kinney III wrote:
> > On Thu, 2007-05-17 at 21:51 -0400, Jim Popovitch wrote:
> > > On Thu, 2007-05-17 at 21:44 -0400, Jamey Owens wrote:
> > > > One note of caution. It can be pretty dangerous to try and use the same
> > > > file for input and output. Lots of shells will leave you with a totally
> > > > empty file using the previous sed command with input & output being equal.
> > >
> > > most recent versions of sed support the -i param which allows for
> > > inplace (same file) editing/changes. man sed. ;-)
> >
> > so the following _should_ work:
> >
> > sed -i 's/abc/xyz/g' <file >file
> >
> > BUT ?!?!? it leaves a 0 length file behind.
>
> as it should. You need to do this:
>
> sed -i -e 's/abc/xyz/g' <file >file
That also dumps the file contents.
>
> ;-)
>
> -Jim P.
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>
--
James P. Kinney III
CEO & Director of Engineering
Local Net Solutions,LLC
770-493-8244
http://www.localnetsolutions.com
GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
More information about the Ale
mailing list