input.txt:/usr/dir1/file1/usr/dir1/file2/usr/dir2/file4/usr/dir3/file5Script:cat input.txt |while read FILENAMEdonawk '{print $1}' ${FILENAME} >> output.txtdoneExpected output:all column1 values of input filesError:nawk: can't open fileThis works fine when i run it like thisnawk '{print $1}' /usr/dir1/file1 >> output.txtnawk '{print $1}' /usr/dir1/file2 >> output.txtnawk '{print $1}' /usr/dir2/file4 >> output.txtI want to be able to run it using a while loop or an if loop with say if $?=0 (using return code).Any ideas on how to do this?i am using solaris 5.10, KSH.
How to make awk work in a while loop
shell script;awk;solaris;ksh