Mailinglist Archive: opensuse (3627 mails)
| < Previous | Next > |
[OT] Questions about editing files with sed and awk
- From: wilson@xxxxxxxxxxx (Jonathan Wilson)
- Date: Fri, 01 Jun 2001 12:52:46 -0500
- Message-id: <5.1.0.14.0.20010601124823.0358fe70@xxxxxxxxxxxxxxxx>
Hey,
I'm curious about something. First I should say that I haven't actually tried this with awk yet, since I don't know any, but I have tried this with sed: if you run sed on a file, sed spits the results to standard out. If you try to redirect that back into the source file, it fries it and you have an empty file.
So my question is, is there a way to /edit/ a file with sed (or awk) directly, without first redirecting it to a tmp file and then catting the tmp file back into the original?
P.S. Does anyone have a PDF or HTML version of O'Reilly's Sed & Awk book?
----------------------------------------------------
Jonathan Wilson
System Administrator
Cedar Creek Software http://www.cedarcreeksoftware.com
Central Texas IT http://www.centraltexasit.com
I'm curious about something. First I should say that I haven't actually tried this with awk yet, since I don't know any, but I have tried this with sed: if you run sed on a file, sed spits the results to standard out. If you try to redirect that back into the source file, it fries it and you have an empty file.
So my question is, is there a way to /edit/ a file with sed (or awk) directly, without first redirecting it to a tmp file and then catting the tmp file back into the original?
P.S. Does anyone have a PDF or HTML version of O'Reilly's Sed & Awk book?
----------------------------------------------------
Jonathan Wilson
System Administrator
Cedar Creek Software http://www.cedarcreeksoftware.com
Central Texas IT http://www.centraltexasit.com
| < Previous | Next > |