Pass a variable as an agruement for cut
I want to pass a variable as an arguement in a cut statement.
Here is basically what I want to do Opt=3 Optlist="banana apple orange grape" optsel=`echo $Optlist | cut -d " " -f $Opt` I want to cut the third field, or what ever Opt is set to at the time, from optsel. The problem is putting $Opt after -f doesn't work nor does "$Opt", '$Opt' Can anyone help me. |
Switch the -f and -d options and it does work.
Code:
optsel=`echo $Optlist | cut -f $Opt -d " "` |
All times are GMT -5. The time now is 09:11 PM. |