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 12:38:25 +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>
- Organization: Open Source Development Lab
On Mon, 5 Aug 2002 12:43:44 -0400 Viktor Pavlenko <vvp@example.com> wrote: > If your file is named crs.txt, do > > $ perl -pe 'BEGIN{$/=""} s/\n(?=\D)/ /g' < crs.txt > > Well I wanted something like > > perl -pe 's/\n(\D)/ $1/sg' < crs.txt > or > perl -pe 's/\n(?=\D)/ /sg' < crs.txt > > but they don't work. Any ideas why? > The latter two, with the default record separator, read each line from crs.txt into "$_" one by one. Then, $_ is terminated with "\n" and never matches up with the regexes like /\n(\D)/ or /\n(?=\D)/. When you replace "$/" with "" as you did with the first solution, the lines in the file are concatenated into one and are read into "$_" at a time. Then it matches the regexes. If you don't like BEGIN, the package constructor, how about this: $ perl -0777pe 's/\n(?=\D)/ /g' crs.txt -- SAKUMA Junichi <jun@example.com> Key fingerprint = 199D 03E9 E7C0 CC66 E2D9 AD3F CB2E F76F 8AD9 FC62
- Follow-Ups:
- Re: [tlug] sed or perl script help please . . .
- From: Viktor Pavlenko
- References:
- [tlug] sed or perl script help please . . .
- From: Jean-Christian Imbeault
- Re: [tlug] sed or perl script help please . . .
- From: Viktor Pavlenko
Home | Main Index | Thread Index
- Prev by Date: RE: [tlug] "Linux Friendly" ADSL Providors
- Next by Date: Re: [tlug] sed or perl script help please . . .
- 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