Click to See Complete Forum and Search --> : Removing A Line In Perl


MrNewbie
02-22-2001, 04:17 PM
If I open a file in perl, how can I remove one line from it based on the first word of the line to make something like this:

One Two Three
Four Five Six
Seven Eight Nine

Into this:

One Two Three
Seven Eight Nine

? So theres no blank line under the previous line and next line.
Thanks
MrNewbie

TheLinuxDuck
02-22-2001, 04:46 PM
If it's loaded into an array, you can:


for(@database) {
print DATABASEFILEHANDLE if(/^[^Four]/);
}


That should do it. :)

MrNewbie
02-22-2001, 05:28 PM
Thanks a lot.
MrNewbie

jemfinch
02-22-2001, 06:36 PM
perl -ni -e 'print if $_ !~ m/^Four/'

Jeremy