I have a file called as 'readfile.csv' with following contents.
Name Id VAl Number IP
James,007,$500,111-111-111,111-000-000
Bond,700,$900,100-000-999, 666-999-000
Here Name, Id, Val, Number and IP are heading in the csv file and the second line i.e., FirstVal, SecondVal etc are the values of those headers. I want to read only the values and not headers and display it in console. How do I do it? And also I want to read values till end of line/end of file as I don't know how many columns can be present in the file. It can be 5 or 6 columns.
Right now I am able to read a single line without header as below in shell script. But this does not help my condition mentioned here.
#!/bin/bash
val1=( $(cut -d ',' -f1 readfile.csv ) )
printf "%s\n" "${val1[0]}"
val2=( $(cut -d ',' -f2 readfile.csv ) )
printf "%s\n" "${val2[0]}"
val3=( $(cut -d ',' -f3 readfile.csv ) )
printf "%s\n" "${val3[0]}"
I actually want to append these values to other script. For example, I have a script called as runfile.sh which appends the values from the awk and opens a file location through http.
Example, 'runfile.sh' is storing this value:
'https://my_win_loc/personinfo'
Now runfile will read the csv file and append each value to this url, like this:
'https://my_win_loc/personinfo/James'
'https://my_win_loc/personinfo/Bond'
Please help me in resolving this. Thanks in advance.