This shows you the differences between two versions of the page.
— |
read_comma_separated_file_csv_within_bash_script [2012/10/25 08:51] (current) root created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Read comma separated file (CSV) within bash script ====== | ||
+ | |||
+ | #!/bin/bash | ||
+ | IFS=, | ||
+ | while read field1 field2 | ||
+ | do | ||
+ | echo "field1 : $field1" | ||
+ | echo "field2 : $field2" | ||
+ | done < filename.csv | ||
+ | |||
+ | References | ||
+ | |||
+ | [[http://www.cyberciti.biz/faq/linux-unix-appleosx-bsd-shell-parse-text-file/]] | ||
+ | |||
+ | [[http://www.cyberciti.biz/faq/unix-linux-bash-read-comma-separated-cvsfile/]] | ||