Remove every fourth line from CSV file?
Hi,
I have a large csv file which has data for every 15 minutes and I need only the hourly data. I would like to keep the first line, delete the next three lines, keep the fourth etc... Sample of the orig data: Code:
01/01/2009 0:00:57 sleep 84 8.4 -13.11 Code:
01/01/2009 0:00:57 sleep 84 8.4 -13.11 Any help is appreciated! Thanks. |
Code:
sed -n '1~4p' input See http://www-h.eng.cam.ac.uk/help/tpl/unix/sed.html |
Works like a charm, exactly what I needed! Thank-you so much!
|
No problem :)
If you want to change the starting line, change the 1 to the line you want to start from. Likewise change 4 to 8 if you want it every 2 hours instead. I'm sure there is an awk solution too, but if this works, so much the better. It's not exactly the longest command ever, either :) |
All times are GMT -5. The time now is 10:52 AM. |