I have a problem and would appreciate any assistance. I have test1.txt file with the following columns:
column1|column2|column3|column4|column5|column6|column7|column8|
I then run the following to target specific columns.
cat test1.txt | awk -F "|" '{ print $2, $3, $4, $6, $7}' > teste.csv
The CSV file outputs the result in 1 line like so:
column2 column3 column4 column6 column7
but what i want is something like
header2|header3|header4|header6|header7
column2|column3|column4|column6|column7
Would you be able to help me fix the above and - also how can i then add headers after getting the correct result.
Thanks in advance