I need to trim the header in a csv file. I have used tail -n +2 ... which works fine but it is really slow (I have lots of 100M files), and I don't understand why since no memory is needed from tail to achieve this (unlike tail -n 10000 for instance).
I have tried awk '{if (NR > 1) print $0}'. It is a bit faster but still orders of magnitude slower than cat. But cat doesn't have that option.
Are there other commands? Thanks
{ head -n 1 >/dev/null; cat; } <infilethough that won't work with allheads so you might as well try{ sed -n 1q; cat; } <infile... – don_crissti Jun 20 '17 at 09:39catdoes and it is 100x faster – Thomas Jun 20 '17 at 09:46sedworked for me, not sure whyheaddoesn't. And it is really fast, thanks! if you want to write it as an answer, please do – Thomas Jun 20 '17 at 09:47{ read -r line; cat; } <file– George Vasiliou Jun 20 '17 at 09:52