For example: If the csv file contains 3 columns, then i have to print the column names. The field separator is (comma).
example.csv (contains 2 lines as follows)
This is,a test file, for validation purpose
This is,"""a test"", file","for validation "" pupose"""
I need the output like this:
1st line:
Input string: This is,a test file, for validation purpose
1st field:This is
2nd field:a test file
3rd field:for validation purpose
2nd line:
Input string: This is,"""a test"", file","for validation "" pupose"""
Actually from excel file, the data looks like this
(This is "a test", file for validation " pupose")
1st field:This is
2nd field:"a test", file
3rd field:for validation " pupose"
d02 $ cat test.dat
This is,a testfile,for validation
This is ," a test file","for validation puropse"""
d02 $
d02 $ awk -F, '{print "Input string : " $0 "\n" "1srt field : "$1 "\n" "2field : " $2 "\n" "3rd field : " $3 "\n"}>
Input string : This is,a testfile,for validation
1srt field : This is
2field : a testfile
3rd field : for validation
Input string : This is ," a test file","for validation puropse"""
1srt field : This is
2field : " a test file"
3rd field : "for validation puropse"""