1/24 Is there a way to do the substr function in a shell script?
I want do command | foo 4 10 to get the 4th to 10th character
of output. Thanks!
\_ printf(1) might work
\_ cut -c 4-10 if you want 4th through 10th of every line; otherwise
you'll probably need some sed/perl hack since most UNIX utils
treat lines as separate records. -alexf
\_ Try awk '{print $x}' | cut -c 4-10 where x = your item in the line.
If you need to do something with the rest of the line you can start
playing with 'tee' and shit like that but perl is probably a better
long term choice.
\_ awk has a substr function.
# substr($2,9,7) picks out characters 9 thru 15 of column 2
{print "imarith", substr($2,9,7) " - " $3, "out."substr($2,13,3)}
--dim |