Re: generous sed?
From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 07/13/04
- Next message: Ed Morton: "Re: generous sed?"
- Previous message: William: "Re: generous sed?"
- In reply to: Ed Morton: "generous sed?"
- Next in thread: Ed Morton: "Re: generous sed?"
- Reply: Ed Morton: "Re: generous sed?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 13 Jul 2004 17:24:37 GMT
On Tue, 13 Jul 2004 11:25:33 -0500, Ed Morton <morton@lsupcaemnt.com> wrote:
>
>
> How can I get sed to be less greedy when matching REs. I have an input
> file like:
>
> abc [ def ] ghi [ klm ] nop
>
> and I'd like to output:
>
> abc ghi nop
>
> There isn't always white space before or after the "[" or "]" - I just
> want to get rid of whatever is withing the square brackets.
>
> Initially, I didn't expect to ever see 2 sets of square brackets on one
> line so I had:
>
> sed 's/\[.*\]/'
>
> but of course that outputs this for the above input:
>
> abc nop
>
> I know how to do this in awk, but I have a few other things I'm doing
> with that sed command and I'd rather not convert it all to awk at this
> time or introduce a pipe between sed/awk.
>
> Regards,
>
> Ed.
>
s/\[[a-zA-Z0-1]\]//g
?
AC
- Next message: Ed Morton: "Re: generous sed?"
- Previous message: William: "Re: generous sed?"
- In reply to: Ed Morton: "generous sed?"
- Next in thread: Ed Morton: "Re: generous sed?"
- Reply: Ed Morton: "Re: generous sed?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|