Solution: Trim top and bottom rows from CSV UNIX SH

Development | Software Testing
Description
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
Attachments
No attachments
Solutions
Description
#!/bin/sh
echo "" >> file.tmp
head -n -1 file.csv > file.tmp
tail -n +6 file.tmp > newfile.csv

on November 28th, 2018 (9:33 pm)
All coments
This solution has not been commented yet.
You must sign in to comment!! LOGIN
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