Skip to content

Instantly share code, notes, and snippets.

@johnrizzo1
Created August 3, 2016 15:02
Show Gist options
  • Save johnrizzo1/4d655bbed72a04667cddf906c63c327b to your computer and use it in GitHub Desktop.
Save johnrizzo1/4d655bbed72a04667cddf906c63c327b to your computer and use it in GitHub Desktop.
# Purpose: Read a file and parse each line into two variables
# File Format
# Each line is a space separated set of fields
# $first - the first field in the file
# $rest - all remaining fields in the file
while read i
do
echo $i
first=${i[(w)0]}
print "\tFirst: $first\n"
rest=${i[(w)1:2]}
print "\tRest: $rest\n"
done < test_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment