Ask a Question related to Linux / Unix Administration, Design and Development.
-
Bowser325 #1
sed help!
I'm trying to edit multiple zone files @ once using sed, but when I run the
below command to replace the numeric string that is on the same line as
string "Serial" I get each digit in the numeric string being replaced by
the 10 digit replacement string.
sed /Serial/s/\[0-9]\/1234567890/g filename
Any help would be appreciated...
Thanks.
Aaron.
Bowser325 Guest
-
Laurenz Albe #2
Re: sed help!
Bowser325 <mccallaREMOVE!@thepacketlounge.org> wrote:
Try> I get each digit in the numeric string being replaced by
> the 10 digit replacement string.
>
> sed /Serial/s/\[0-9]\/1234567890/g filename
sed -e '/Serial/s/[0-9]\{1,\}/12345/g' filename
Yours,
Laurenz Albe
Laurenz Albe Guest
-
Bowser325 #3
Re: sed help!
Thanks a lot. Any chance of getting a brief explanation of the {1,\}?
Thanks.
Aaron.
"Laurenz Albe" <albe@culturallNOSPAM.com> wrote in message
news:cg4l85$mh2$1@at-vie-newsmaster01.nextra.at...by> Bowser325 <mccallaREMOVE!@thepacketlounge.org> wrote:> > I get each digit in the numeric string being replaced>> > the 10 digit replacement string.
> >
> > sed /Serial/s/\[0-9]\/1234567890/g filename
> Try
>
> sed -e '/Serial/s/[0-9]\{1,\}/12345/g' filename
>
> Yours,
> Laurenz Albe
Bowser325 Guest
-
Dave Hinz #4
Re: sed help!
On Fri, 20 Aug 2004 11:10:23 -0400, Bowser325 <mccallaREMOVE@thepacketlounge.org> wrote:
Please don't top-post.> Thanks a lot. Any chance of getting a brief explanation of the {1,\}?
Dave Hinz Guest
-
Laurenz Albe #5
Re: sed help!
Bowser325 <mccallaREMOVE@thepacketlounge.org> wrote:
\{n,m\} means n to m repetitions of the preceeding pattern, in that> Thanks a lot. Any chance of getting a brief explanation of the {1,\}?>> sed -e '/Serial/s/[0-9]\{1,\}/12345/g' filename
case [0-9]. The missing m means that there is no upper limit.
It is very rewarding to read documentation on regular expressions.
They occur frequently in UNIX.
Yours,
Laurenz Albe
Laurenz Albe Guest



Reply With Quote

