Solution: Trim top and bottom rows from CSV UNIX SH

Development | Software Testing
I need to trim the top 5 rows and the last row of my csv using a unix command that I can run in a shell script. I currently have head -n -1 file.csv | tail -n +6 file.csv > newfile.csv this outputs a new csv starting from row 6 which is what I need however the first part of the command fails as illegal line count -- -1
No attachments.
echo "" >> file.tmp
head -n -1 file.csv > file.tmp
tail -n +6 file.tmp > newfile.csv

on November 28th, 2018 (9:33 pm)
What masters said
You must sign in to comment!!
All comments
This solution has not been commented yet.
We use cookies to give you the best possible experience on our site. By continuing to use the site you agree to our use of cookies. Find out more Accept