I am using cut to eliminate last two characters of a file:
cut -c1-40 <inputfile >outfile
Before, I have used wc to know the number of characters in the file:
wc -c inputfile
Now I would like to use this information to write a shell script First I have obtained the total of characters in the file and subtracte 3 from that number. I would like to use the content of the variable to use it on cut.
nc=`wc -c < $inputfile`
nc=`expr $nc - 3`
Now I would like to have something like
cut -c1-$nc <inputfile >outfile
but it doesn't work.