![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DB Solo 3.0 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-26-2008 04:00 PM |
| DB Solo 3.0 Beta 1 (Default branch) | iBot | Software Releases - RSS News | 0 | 01-22-2008 09:10 PM |
| script works on command line, not in cron job | JackTheTripper | UNIX for Dummies Questions & Answers | 7 | 06-27-2007 01:51 AM |
| works from cmd-line but not in script | OFFSIHR | Shell Programming and Scripting | 4 | 10-18-2006 08:41 AM |
| Appending line with sed works on Linux but not on Solaris | nir_s | Shell Programming and Scripting | 4 | 08-11-2005 03:00 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Line works in solo but not in program?
Now I am just getting frustrated and confused... if anyone has some advice on how this anomoly is occurring I would greatly appreciate it.
Code:
cat helpme.txt | awk 'NR<5{printf("%-20s %-20d %-20d %-20.1f\n","hello",$1,$2,$3)}' | sort -rk4
In a small program it doesn't work... Code:
#!/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
And yes with only the three fields in the short program it does work fine. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|