hewarn has asked for the wisdom of the Perl Monks concerning the following question:
I am reading result a file and have already found the lines I wish to join but...this is not working....
I have names like Mary,Alan,David and I am searching for those from file. Once I have found it, I just would like to remove empty lines and attach the next written line after the word.
Original file looked like
I cant seem to get that end of line off and join those lines...Alan 2.13 Mary 2.16 And the new file would be: Alan 2.13 Mary 2.16
Small but irritating problems cause I dont know how.
BR Hewarnopen (ROWS, "style.txt") || die "File not found"; while (defined ($rivi = <ROWS>)) { if($rivi =~ /^$names[$i]/) { chomp $rivi; $rivi=~tr/\n\n//; $rivi=~s/\n\n//; $rivi=~tr/0xb6//; $rivi=~tr/0xb6//; . . . . my $text=$text.$rivi; open (E,">>style1.txt"); print E $text; close E; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Remove newlines and join lines
by cfreak (Chaplain) on Aug 28, 2002 at 14:02 UTC | |
|
Re: Remove newlines and join lines
by Django (Pilgrim) on Aug 28, 2002 at 14:43 UTC | |
|
Re: Remove newlines and join lines
by moxliukas (Curate) on Aug 28, 2002 at 14:14 UTC | |
|
Re: Remove newlines and join lines
by mce (Curate) on Aug 28, 2002 at 14:21 UTC | |
|
Re: Remove newlines and join lines
by Abigail-II (Bishop) on Aug 28, 2002 at 14:54 UTC | |
|
Re: Remove newlines and join lines
by hotshot (Prior) on Aug 28, 2002 at 13:50 UTC | |
|
Re: Remove newlines and join lines
by hewarn (Initiate) on Aug 28, 2002 at 15:44 UTC | |
by BrowserUk (Patriarch) on Aug 28, 2002 at 19:24 UTC | |
by Django (Pilgrim) on Aug 28, 2002 at 16:00 UTC |