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
Try this:
for i in `cat test.txt`; do
IFS='^'
arr=($i)
for col in "${arr[@]}"; do
echo "$col"
done
break;
done