Now I am just getting frustrated and confused... if anyone has some advice on how this anomoly is occurring I would greatly appreciate it.
cat helpme.txt | awk 'NR<5{printf("%-20s %-20d %-20d %-20.1f\n","hello",$1,$2,$3)}' | sort -rk4
This line works fine in solo - reads the three fields from helpme.txt and adds a first field "hello" before the others on output... seems simple enough and it works fine on its own on the command line.
In a small program it doesn't work...
#!/bin/sh
echo "Please enter the file you want compressed: \c"; read filename
echo File: $filename
# check to see file exists and is readable with -r
if [ -r $filename ]
then
echo gzip | gzip -f $filename; gunzip -l $filename.gz > $filename.txt; gunzip $filename
gzip -f rose.bmp; gunzip -l rose.bmp.gz >> $filename.txt; gunzip rose.bmp.gz
cat helpme.txt | awk 'NR<5{printf("%-20s %-20d %-20d %-20.1f\n","hello",$1,$2,$3)}' | sort -rk4
else
echo sorry the file does not exist or is not readable
fi
So at this point I am thinking magic?
And yes with only the three fields in the short program it does work fine.