Error running nawk script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error running nawk script
# 1  
Old 02-16-2011
Error Error running nawk script

Hi,

I was trying to use nawk script given in this link

df output is not aligned.

but when i do this im getting this error

Code:
$ df -k|formatDF.nawk
-ksh: formatDF.nawk: not found [No such file or directory]

Can anyone help me on this...

Last edited by pludi; 02-16-2011 at 07:48 AM.. Reason: code tags, title
# 2  
Old 02-16-2011
--delete--

oops ...i mixed with another thread

Last edited by ctsgnb; 02-16-2011 at 08:36 AM.. Reason: i mixed with another thread
# 3  
Old 02-16-2011
Quote:
Originally Posted by niteesh_!7
Hi,

I was trying to use nawk script given in this link

df output is not aligned.

but when i do this im getting this error

Code:
$ df -k|formatDF.nawk
-ksh: formatDF.nawk: not found [No such file or directory]

Can anyone help me on this...
Do you have nawk in the /bin directory?
What is the output of which nawk?

Is the script executable (chmod)?
What is the output of ls -l formatDF.nawk ?
# 4  
Old 02-16-2011
did you make 'formatDF.nawk' executable?
did you specify the correct path to formatDF.nawk?
# 5  
Old 02-16-2011
could also use something like:
Code:
df -k | cat | while read a b c d e f
do
printf "%-40s %10s %10s %10s %8s %-50s\n" $a $b $c $d $e $f
done

the problem is the hardcoded length of the columns

could make display ##### if the column length is exhausted (could also change the code to raise an error message)
Code:
df -k | cat | while read a b c d e f
do
[[ ${#a} -gt 40 ]] && a="########################################"
[[ ${#b} -gt 10 ]] && b="##########"
[[ ${#c} -gt 10 ]] && c="##########"
[[ ${#d} -gt 10 ]] && d="##########"
[[ ${#f} -gt 40 ]] && f="########################################"
printf "%-40s %10s %10s %10s %8s %-40s\n" $a $b $c $d $e $f
done


Last edited by ctsgnb; 02-16-2011 at 09:19 AM..
# 6  
Old 02-16-2011
output of which nawk:
$ which nawk
nawk=awk

output of ls -l formatDF.nawk

$ ls -l formatDF.nawk
-rwxrwxrwx 1 ravi ravi 796 Feb 16 06:25 formatDF.nawk
# 7  
Old 02-16-2011
Try this if you have the nawk file in your current directory:
Code:
df -k | ./formatDF.nawk

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error running script

Hi, I have the the below script more runcda.sh if *\).*/\1/p' $1_dr) ]; then echo "ParallelGCThreads Found with Value" else echo "ParallelGCThreads Not Found - Add !!" fi $ ./runcda.sh output.log ./runcda.sh: test: argument expected ParallelGCThreads Not Found - Add !! Why am i... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. Shell Programming and Scripting

Error in running DB query by script

Hi I was trying to fetch data from database. But the number of rows exported were huge so i got the error. Experts please advice. Thanks a lot for your supprt. #: ./script.sh ./script.sh: xmalloc: subst.c:3076: cannot allocate 1401346369 bytes (0 bytes allocated) (2 Replies)
Discussion started by: brij123
2 Replies

3. Shell Programming and Scripting

Error when running script in background

Hi guys, ./test.sh & #!/usr/bin/ksh echo "No.Of Items :" read count echo "Report Time (Min):" read time some other command .... exit 0; thanks (3 Replies)
Discussion started by: asavaliya
3 Replies

4. UNIX and Linux Applications

Getting error code when running the script 2 (RC)2

hi All, we have a script to remove the files from particular path,when we tryingto run manually the script went to success and removed the files but the same script which is running by other team it got failed and giving the error "2 (RC)2 "..what is the cause of the failure..and we passing the... (2 Replies)
Discussion started by: nagavenkatesh
2 Replies

5. Red Hat

error running postrotate script

Hi, I am getiing emails from cron.daily with subject: Cron root@vsftp run-parts /etc/cron.daily /etc/cron.daily/logrotate: /sbin/killall -HUP radiusd : line 1: /sbin/killall: No such file or directory error: error running postrotate script for /var/log/vsftpd/logfile the... (6 Replies)
Discussion started by: renuka
6 Replies

6. Solaris

Error when running script

Hi All, Need your guuys help here. #!/bin/bash { echo "POLICY LIST" echo "====================================" bppllist echo " " echo "POLICY DETAILS" echo "====================================" for type in daily weekly monthly quarterly echo... (6 Replies)
Discussion started by: ronny_nch
6 Replies

7. Shell Programming and Scripting

Error while running as shell script

Storage_Unit=`du -h /var/spool/cron/root|awk '{print $1}'|sed -e "s/^.*\(.\)$/\1/"` If then Size=`du -h /var/spool/cron/root|awk '{print $1}'|sed 's/.\{1\}$//'` for Size_rounded_number in $(printf %.0f $Size); do ROUNDED_Size=$Size_rounded_number done if #setting a threshold of say... (1 Reply)
Discussion started by: proactiveaditya
1 Replies

8. UNIX for Advanced & Expert Users

Error occured while running a script

Hi All, In my application, I'm getting an error as type mismatch Let me now explain the scenario, I ran a shell script which calls some other scripts. All these scripts uses the environment variables. Take for example, this script uses a variable 'PathDir'. I initiallized the value to... (2 Replies)
Discussion started by: iamgeethuj
2 Replies

9. Shell Programming and Scripting

error in in running script

Hi all, I have created a script file .sh and had some allias commands, local variable, some grep features, and listing files/directories, and it worked correctly and I got the outputs I am looking for after I run the script . However, some of the grep commands and some other functions did not... (2 Replies)
Discussion started by: aama100
2 Replies

10. UNIX for Dummies Questions & Answers

Error while running a script

Hi all, By running a (command) script I'm getting the following error: .: /usr/bin/test: cannot execute binary file This is the command: $ . test The script (test) is very simple sqlplus user/password @1.sql sqlplus user/password @2.sql Can enyone tell me what the problem is. (5 Replies)
Discussion started by: HarryTellegen
5 Replies
Login or Register to Ask a Question