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 perl script help please . . .
- Date: Tue, 6 Aug 2002 13:54:09 +0900 (JST)
- From: SAKUMA Junichi <jun@example.com>
- Subject: Re: [tlug] sed or perl script help please . . .
- References: <F132q9IcVux1Zcn8TtE000005b5@example.com><15694.43840.422094.372348@example.com><20020806123947.6b8a9907.jun@example.com><15695.19559.378168.971468@example.com>
- Organization: Open Source Development Lab
On Tue, 6 Aug 2002 00:11:19 -0400 Viktor Pavlenko <vvp@example.com> wrote: > Did you notice the s modifier in the samples above? > > So, s modifier means: you can treat it as a single line as long as you > don't mess with the record separator... > The s modifier is evaluated *after* each line is read into $_. So $_ *is* terminated with every \n in the data source. The s modifier does nothing in this situation. You would have seen that the lines are read *before* the s modifier if you had done this with a script file, not with a one-liner. > In the following example $_ is not terminated by the first \n and all > replacements are made: > > $ perl -pe 's/\n/ /sg' < crs.txt > > This works too, through all lines: > > $ perl -pe 's/o/O/sg' < crs.txt > The examples above are just comping each line. The chomped lines are printed because of the -p option and look concatenated on the screen. That's why the above one-liners didn't work with the original question as expected. -- SAKUMA Junichi <jun@example.com> Key fingerprint = 199D 03E9 E7C0 CC66 E2D9 AD3F CB2E F76F 8AD9 FC62
- References:
- [tlug] sed or perl script help please . . .
- From: Jean-Christian Imbeault
- Re: [tlug] sed or perl script help please . . .
- From: Viktor Pavlenko
- Re: [tlug] sed or perl script help please . . .
- From: SAKUMA Junichi
- Re: [tlug] sed or perl script help please . . .
- From: Viktor Pavlenko
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] sed or perl script help please . . .
- Next by Date: [tlug] sed or awk or what?
- Previous by thread: Re: [tlug] sed or perl script help please . . .
- Next by thread: Re: [tlug] sed or perl script help please . . .
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links