Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
remove top line in file
Name: Pete Date: March 26, 2003 at 01:45:24 Pacific OS: Linux CPU/Ram: 512MB
Comment:
This may be a silly question but does anyone know how I can remove the top line of a file and save it to another file. Is there a command for this. Many thanks.
Or for variety, head -n1 yourfile.dat > newfile.dat
Another great book is "Learning the Korn Shell" by Bill Rosenblatt (O'Reilly). What I like about it is the way it describes how things work rather than just listing syntax and examples. It has quite a bit about using the command line and customising your environment as well. There are a lot of convenient shortcuts that people often don't know about.
Also if you're going to be spending any time working with Unix, get the O'Reilly book on the vi editor and work through it from cover to cover (it's not that long). I did this about 10 years back (we had a slow patch at work) and I'm so glad I did. vi is a terrific editor once you get to know it (and the regular expression syntax is pretty much the same as grep/sed/awk, Perl and JavaScript).
0
Response Number 6
Name: Jimbo Date: March 26, 2003 at 04:55:23 Pacific
Reply:
Ditto on the Oreilly Korn shell book. Also one of my favorites.
-jim
0
Response Number 7
Name: Pete Date: March 26, 2003 at 18:27:21 Pacific
Reply:
Thank you all for helping me out.
Pete
0
Response Number 8
Name: Pete Date: March 26, 2003 at 18:34:35 Pacific
Reply:
I need more help on removing the first line of my file. I have tried both suggestions but both of them seems to extract the 1st line of my old file and places to a new file. I didn't exactly want that. What I wanted to do is to remove the 1st line in the old file then copy the remaining to the new file or make a copy of the original file then remove the 1st line or 1st couple line from the new file. For example, file 1 contains: line 1 line 2 line 3 line 4
File 2 should be: line 2 line 3 line 4
Any suggestion on this? Many thanks.
0
Response Number 9
Name: Jimbo Date: March 26, 2003 at 21:53:23 Pacific
Summary: How can I remove a line in a file? e.g. File containing the following 307 319 352 If I wanted to remove line 319, what would be the syntax? Any alive will be appreciated King Regards Junes...
Summary: Hi, I am trying to find out how to remove the last word in a file. For example, a line in a file will contain: one two three four And I want to remove the word "four" from the line. Thanks! ...
Summary: Hi everyone, I am trying to remove some lines from all the files in a directory, for example I am looking at the fields 25-27 and if it is 19 I am trying to remove the whole line from that file, simi...