shell - Read every line of file in bash and awk -
i have file(test.txt) has contents like
/the/path/foo.txt foo.txt /the/paths/doo.txt doo.txt /the/path/foo.pl foo.pl /the/paths/doo.pl doo.pl /the/path1/soo.csv soo.csv /the/path2/moo.csv moo.csv
i want have awk {print $1} saved variable1 , awk {print $2} saved variable2 in bash script i.e variable1 gets /the/path/foo.txt , variable2 gets foo.txt , on
thanks
you can use read
built-in capture , assign fields variables (assuming there no spaces in paths):
while read -r var1 var2; # variables done < text.txt
Comments
Post a Comment