I have a comma separated list, so ...
00:00:00:00:00:00,Bob Laptop,11111111111111111 00:00:00:00:00:00,Mom & Dad Computer,22222222222222222 00:00:00:00:00:00,Kitchen,33333333333333333
I am trying to iterate over these rows and populate the variables with three columns in each row. My script works when data has no spaces, ampersands or apostrophes. When he has one, then it does not work correctly. Here is my script:
for line in $(cat list) do arr=(`echo $line | tr "," "\n"`) echo "Field1: ${arr[0]}" echo "Field2: ${arr[1]}" echo "Field3: ${arr[2]}" done
If one of you bash gurus can indicate how I can get this script to work with my list, I would really appreciate it!
E.V.
source share