Wednesday, July 18, 2012

Delete first and last line of a file

To delete only the first and last lines of a file on *nix, you can use the following sed one-liner

sed "1d;$d" < inputfile.txt > outputfile.txt

Similarly, you can extend this example to other specific line numbers in the file as well.

No comments:


Related Posts Plugin for WordPress, Blogger...