I know this should be simple, but sorry I am fairly new to UNIX and can't find the syntax to make this work.
I have following two commands in a script:
x=`expr $(head -1 filename.ext | cut -c16 | grep [A-Z] | wc -l) + 16`
del=`head -1 filename.ext | cut -c$x`
This works fine as I expect it to. But I want to combine it into one command. Essentially I just want the entire expression that I am assigning to x in the first command to be evaluated at the end of the second command as my argument to the -c attribute of the cut command. But I've tried every way I can to get it to evaluate properly and can't get it.
Thanks for any help.
I have following two commands in a script:
x=`expr $(head -1 filename.ext | cut -c16 | grep [A-Z] | wc -l) + 16`
del=`head -1 filename.ext | cut -c$x`
This works fine as I expect it to. But I want to combine it into one command. Essentially I just want the entire expression that I am assigning to x in the first command to be evaluated at the end of the second command as my argument to the -c attribute of the cut command. But I've tried every way I can to get it to evaluate properly and can't get it.
Thanks for any help.