no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | blog:readdelimfile [2009/11/27 17:53] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Read a Delimited File ====== | ||
+ | How can you read a row in delimited file and get each field value into a separate variable? | ||
+ | |||
+ | <code bash> | ||
+ | # | ||
+ | |||
+ | IFS=":" | ||
+ | while read f1 f2 f3; do | ||
+ | echo " | ||
+ | done < delim.txt | ||
+ | </ | ||
+ | |||
+ | Using the following input file as a sample: | ||
+ | < | ||
+ | field1: | ||
+ | field1a: | ||
+ | </ | ||
+ | |||
+ | Sample run: | ||
+ | < | ||
+ | $ ./delim.sh | ||
+ | field1-field2-field3 | ||
+ | field1a-field2a-field3a | ||
+ | </ | ||
+ | {{tag> |