User Tools

Site Tools


read_comma_separated_file_csv_within_bash_script

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/

read_comma_separated_file_csv_within_bash_script.txt · Last modified: 2012/10/25 08:51 by root