I am trying to get the header or the first line of a csv file and print it as a column.
file example: test.txt name^lastname^address^zipcode^phonenumber
expected result:
name
lastname
address
zipcode
phonenumber
Just do this
head -n1 test.txt | tr , '\n'
head
prints n
lines of a file, tr
replaces all occurrences of a first char with a second char
head -n1 test.txt | tr '^' '\n'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With