Hi, you are correct . I have one file like this [praveen@calvin] rpm1.rpm rpm2.rpm rpm3.rpm [praveen@calvin] rpm3.rpm qwe.rpm [praveen@calvin]
I want to remove [praveen@calvin]. evey time [praveen@calvin]cahanges ,It depends on user. so I want to remove the line which starts with '['and ends with ']'. Pls help me. thank you. cheers, prasanthi. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jon Molin Sent: 19 December, 2001 15:37 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Remove a line Prasanthi Tenneti wrote: > > hi, > how to remove a line from a file? > pls help me. press the delete key repetedly? :) but really, i think you'll need to give som more info. what line? first line, last line, random line, line nbr n? would this be it? my $line_to_delete = 7; open (F, 'some_file'); my @file_content = <F>; close (F); open (F, '>same_file'); for (0..$#file_content) { next if $_ == $line_to_delete; print F $file_content[$_]; } close (F); /jon ps check the docs with perldoc perl, www.perl.org and so on, read about files... > thank you. > prasanthi. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]