Friday, June 11, 2010

How would you get the character positions 10-20 from a text file?

cat filename.txt | cut -c 10-20


:)


If you have a string "one two three", Which shell command would you extract the strings?


Input="one two three"
for var in $Input
do
       i=0;
       var.$i=$var
       i=$i+1
done
echo $i
for ( i=0; i< $i; i++)
do
      echo `var.$i`
done


Its a little big solution but thats just a way of playing with script ;)



No comments:

Post a Comment