Article View: gnu.misc.discuss
Article #2156Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files
From: Stefan Monnier foo
Date: Tue, 14 Jan 2003 19:34
Date: Tue, 14 Jan 2003 19:34
28 lines
2104 bytes
2104 bytes
>>>>> "ericjb" == ericjb <ericjb@lksejb.lks.agilent.com> writes:
>> Here is the type of lines I have in a file:
>> junk label="junk1/junk2/junk3/.../junkn/" more junk
>> I want to find every line that has
>> label="..."
>> pattern
>> and then I want to replace every / by _ inside the
>> quotes.
sed '/label=".*"/s|/|_/'
>> cat file |
>> sed commands |
>> awk commands |
I don't know if the Useless Use of Cat Award is still up for grabs,
so I'd recommend you don't bother running for it and just use
redirection instead:
sed commands <file |
awk commands |
-- Stefan
PS: This has nothing to do with Lisp, Emacs, or GNU, so I redirected
the discussion to comp.unix.shell.
Technical Details
Message-ID:
<5llm1ncyqd.fsf@rum.cs.yale.edu>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.ycc.yale.edu!rum.cs.yale.edu!rum.cs.yale.eduReferences:
<b00bb831.0301131603.34e9704c@posting.google.com> <uadi34mue.fsf@lksejb.lks.agilent.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f4fd2,1e8c4b23af1e4636 X-Google-Attributes: gidf4fd2,public X-Google-Thread: 103b8b,1e8c4b23af1e4636 X-Google-Attributes: gid103b8b,public X-Google-Thread: 1025b4,1e8c4b23af1e4636 X-Google-Attributes: gid1025b4,public X-Google-Thread: 1012a6,6b5030ec1bcea943 X-Google-Attributes: gid1012a6,public X-Google-ArrivalTime: 2003-01-14 11:35:10 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.ycc.yale.edu!rum.cs.yale.edu!rum.cs.yale.edu From: "Stefan Monnier <foo@acm.com>" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> Newsgroups: gnu.misc.discuss,comp.lang.lisp,gnu.emacs.help,comp.unix.shell Subject: Re: A very simple question on SED or AWK for a GURU, possibly a lisp script or emacs batch processing of many files Followup-To: comp.unix.shell Date: 14 Jan 2003 14:34:02 -0500 Organization: Yale University Lines: 28 Sender: monnier@rum.cs.yale.edu Message-ID: <5llm1ncyqd.fsf@rum.cs.yale.edu> References: <b00bb831.0301131603.34e9704c@posting.google.com> <uadi34mue.fsf@lksejb.lks.agilent.com> NNTP-Posting-Host: rum.cs.yale.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-Original-NNTP-Posting-Host: rum.cs.yale.edu X-Original-Trace: 14 Jan 2003 14:34:02 -0500, rum.cs.yale.edu