I have quite a large csv
file (call it file.csv
). It looks like this one:
col1,col2,col3,...
1,2,3
1,2,5
...
So after doing something like this cat file.csv | grep "_some_pattern_"
I receive only the output values. Is there a way to append the header (the first line) to the output?
It would be very convenient...
– Jorge Mendes Feb 25 '21 at 07:39head -n 1 input.csv > output.csv && tail -n +2 input.csv | egrep -i "some pattern" >> output.csv