fb_pixel

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
Info
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 job has not been commented yet.