I am attempting to write a script that would read entries from a file (one at a time) and for each entry it should cut the given word from caricature 8 till the 3rd from last character.
I wrote the following
more $TEMP2 | grep join | awk '{print $3}' > $TEMP3
while read group; do
{
LENGTH=`awk '{print length($group)}'`
LENGTH=$(($LENGTH-2))
echo $group > $TEMP0
cut -c8-$LENGTH $TEMP0 >$TEMP4
}
done < $TEMP3
But it is not working if I have more then one entry in the file. It looks like it is noot able to load the new $LENGTH value.
Any help would be appreciated.
Thanks
Gal