Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Read a Delimited File ====== How can you read a row in delimited file and get each field value into a separate variable? <code bash> #!/usr/bin/bash IFS=":" while read f1 f2 f3; do echo "$f1-$f2-$f3" done < delim.txt </code> Using the following input file as a sample: <code> field1:field2:field3 field1a:field2a:field3a </code> Sample run: <code> $ ./delim.sh field1-field2-field3 field1a-field2a-field3a </code> {{tag>shell programming}} blog/readdelimfile.txt Last modified: 2009/11/27 17:53by 127.0.0.1