Link to home
Start Free TrialLog in
Avatar of bje
bjeFlag for United States of America

asked on

use awk and cut

Hello,
Have a file where I need to look at the first line and then look at a postion 30 - 45 on that line and cut the value to be use in a variable.

I have
testname=$(awk 'NR==1|{cut -c30-45}' $file )


thanks
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

testname=$(awk 'NR==1 {print substr($0,30,16)}' $file)
echo $testname

"awk" does not have "cut". "awk" has "substr()".
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bje

ASKER

Thank you