Blog
Developers
Careers
Support
Contact
Gossamer Threads
Solutions
Results
About
Mailing Lists
Resource Centre
Forum
Tools
Home
Who's Online
Tags
Favourites
Login
Register
Forum Search
(
Advanced Search
)
This forum
This category
All forums
for
Home
:
General
:
Perl Programming
:
Need Help Removing Line From File
Previous Thread
Next Thread
Print Thread
View Threaded
May 2, 1999, 3:11 AM
Jimz
User
(207 posts)
May 2, 1999, 3:11 AM
Post #1 of 6
Views: 541
Shortcut
Need Help Removing Line From File
Hello,
I need help with removing the first line of a file. Can anyone help me?
------------------
May 2, 1999, 9:03 PM
Jimz
User
(207 posts)
May 2, 1999, 9:03 PM
Post #2 of 6
Views: 520
Shortcut
Re: Need Help Removing Line From File
In reply to
Im not using a I/D based database.
------------------
May 3, 1999, 12:29 AM
cK
Enthusiast
(567 posts)
May 3, 1999, 12:29 AM
Post #3 of 6
Views: 520
Shortcut
Re: Need Help Removing Line From File
In reply to
You can find such a routine in delete routine in db.pl or db_utils.pl of Links2.0.
Hope this helps...
May 3, 1999, 11:42 AM
cK
Enthusiast
(567 posts)
May 3, 1999, 11:42 AM
Post #4 of 6
Views: 520
Shortcut
Re: Need Help Removing Line From File
In reply to
Then try the following:
-make an array, by splitting by \n
-shift that array
-print that array to file
...and you're ready!
May 3, 1999, 11:32 PM
cK
Enthusiast
(567 posts)
May 3, 1999, 11:32 PM
Post #5 of 6
Views: 520
Shortcut
Re: Need Help Removing Line From File
In reply to
Or check out subscribe.cgi for a delete routine without an ID.
May 4, 1999, 6:42 AM
Alex
Administrator
(9387 posts)
May 4, 1999, 6:42 AM
Post #6 of 6
Views: 519
Shortcut
Re: Need Help Removing Line From File
In reply to
How bout:
open (IN, "<input.txt") or die $!;
open (OUT, ">output.txt") or die $!;
$junk = <IN>;
while (<IN> ) {
print OUT;
}
close IN;
close OUT;
you now have a copy of the input file in the output minus the first line. Do a rename() to overwrite the file.
Cheers,
Alex
Previous Thread
Next Thread
Print Thread
View Threaded