Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] sed or awk or what?
- Date: Tue, 06 Aug 2002 20:24:07 -0500 (CDT)
- From: Sven Simon <sven@example.com>
- Subject: Re: [tlug] sed or awk or what?
- References: <1028624439.3d4f90371095e@example.com> <1028635621.11013.63.camel@example.com> <1028638499.10989.94.camel@example.com>
- User-agent: IMP/PHP IMAP webmail program 2.2.3
Quoting Bruno Raoult <br@example.com>: > Or shorter: > > sed -e '2s/\(.* \)\{8\}[^ ]*/\170' < A.txt > > But I did not test on other systems than mine (linux): > I am always afraid when I use these kind of regexp > with sed, I had some bad experiences at work :-( > > I am not sure this works on Solaris/AIX/MacOS X (yes, > the new one we can include in Unix tests!) and others. > > One example: some sed versions will need a "/" at the > end of the substitute command: It would be better to > add it in all cases. > > br. > > On Tue, 2002-08-06 at 21:07, Bruno Raoult wrote: > > What about this one? > > > > sed -e '2 s/\(.* \)\{8\}[^ ]*\(.*\)/\170\2/' < A.txt > > > > br. > > Thanks Bruno, you've pointed me in the right direction. But after digging up the sed section in good old "Unix Power Tools" I saw we can set a numeric flag for pattern matches in the substitute command, so I came up with this: sed -e '2s/[^ ]* /70 /9' A.txt Easy enough, no? It sure took me a while, though. Ah, Regular Expressions - what a headache!
- References:
- [tlug] sed or awk or what?
- From: Sven Simon
- Re: [tlug] sed or awk or what?
- From: Bruno Raoult
- Re: [tlug] sed or awk or what?
- From: Bruno Raoult
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Perl and locale errors
- Next by Date: Re: [tlug] [announcement] 8/16 TLUG nomikai meeting
- Previous by thread: Re: [tlug] sed or awk or what?
- Next by thread: Re: [tlug] sed or awk or what?
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links