1 2 3 4 5 6
#!/bin/bash for ((i=0;i<=17;i+=1)) do option=`more test.txt|awk -F' ' '{ print $1}'` echo $option done
Refactorings
No refactoring yet !
roxannspencerolsen.blogspot.com
May 8, 2008, May 08, 2008 20:50, permalink
Solved...
1 2 3 4 5
for ((i=1;i<=17;i+=1)) do option=`more test.txt|awk -F' ' '{ print $'$i'}'` echo $option done
I an working on a script that asks for user to select functions using a kdialog checklist. The selected options are then processed.
I have pushed all of the output from the kdialog into a temporary file (for testing - later I plan to cram it into a var)
There are 17 items on the list. I need the code to awk the list 17 times using a different position each time so that each item that is checked can be done. My biggest challenge is getting the awk { print $x} where x is increased by one each time the for loop runs. Thanks for your help