Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] sed or perl script help please . . .



Viktor, Junichi,

Maybe we did not understand the problem the same way, but with your
program you will get many lines with se same number (if you assume
for instance that the "2 XXX" could be duplicated). Should not you
include a real counter somewhere? (1, 2, 3, etc...)

br.


On Tue, 2002-08-06 at 01:43, Viktor Pavlenko wrote:
> >>>>> "JI" == Jean-Christian Imbeault <jean_christian@example.com> writes:
> 
>     JI> I have a file that contains lines like this:
> 
>     JI> 1 some
>     JI> text with
>     JI> C/R's
>     JI> in annoying places
>     JI> 2 more text
>     JI> with CRs
>     JI> 3 text text text
>     JI> 4 text text
> 
>     JI> I'd like to concat the lines that don't have leading numbers
>     JI> in to one long line like this:
> 
>     JI> 1 sometext with C/R's in annoying places
>     JI> 2 more text with CRs
>     JI> 3 text text text
>     JI> 4 text text
> 
>     JI> Can someone suggest a sed (or perl if it is better suited to
>     JI> this) script to concat the lines?
> 
> 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?
> 
> Viktor
> 
> 
> *************************************************
> TLUG server is hosted by Global Online Japan
> http://home.gol.com/index_e.html
> *************************************************
> 
> =================================================
> To unsubscribe from this mailing list, 
> please see instructions at
> http://www.tlug.jp/list.html
> =================================================
> 
-- 
Warning: This signature is a Linux virus.
Please delete one file, then set it as your signature.

Attachment: signature.asc
Description: This is a digitally signed message part


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links