blanks in an awk comand


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting blanks in an awk comand
# 1  
Old 08-25-2004
blanks in an awk comand

Hi,

Im trying to write something that will report if a filesytem is over 80% but the problem is the output reports on a dir that is a 9%.

any ideas?

this is what I have

*************************************************
if [ -z "$1" ]
then
param=90
else
param=$1
fi
df -kl | grep -iv filesystem | awk ' { if ( $5 > "80%" || $5 >= p"%" ) { print }
}' p=$param -
exit 0
**************************************************
My output is as follows.

/dev/stand 56227 5017 51210 9% /stand
/dev/dsk/c0b0t0d2s1 17709056 14750200 2958856 84% /bi
# 2  
Old 08-25-2004
This works for me....

Code:
df -kl | grep -iv filesystem | awk ' { sub( "%", "", $5 ) } { if ( $5 > 80 ) { $5 = $5"%"; print $0 } } '

Cheers
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to remove row 1 and blanks

I am trying to remove $1 along with the blank values from the file. Thank you :). file R_Index Chr Start End Ref Alt Func.IDP.refGene Gene.IDP.refGene GeneDetail.IDP.refGene Inheritence ExonicFunc.IDP.refGene AAChange.IDP.refGene avsnp147 PopFreqMax ... (5 Replies)
Discussion started by: cmccabe
5 Replies

2. Shell Programming and Scripting

Problem with blanks, shifting the row when using awk

Hello, I have files with fixed length fields. 12345 12345 12345671234567 10 1234567 12345 12345 123456 1234567 10 1234567 I want to take 1st, 3rd, 4th and 6th string. Usually 3rd and 4th string are coming as it is on the first row /1234567 and... (3 Replies)
Discussion started by: apenkov
3 Replies

3. Shell Programming and Scripting

UNIX comand

Team, I need unix command to grep directory part from the string for example I have a texts something like /apps/opt/data/current/spool/test.dbf /apps/opt/archive/../../test.dbf I need only directory part from that string like my out put will /apps/opt/data/current/spool/... (1 Reply)
Discussion started by: asappidi
1 Replies

4. Shell Programming and Scripting

Passing variable as an input file to AWK comand

Hi, I would like to compare 2 files using awk, which I can do by using: awk 'NR==FNR{a;next} (NR > 32 && $2 in a) {print $0}' File1 and File2. If the name of the File1 is in another file (for example, column 4 in File 3) then how can I pass this column 4 to the awk command. Thanks in... (1 Reply)
Discussion started by: ezhil01
1 Replies

5. Solaris

Using dd comand

Hello peolple i have to check a tape with de dd comand and redirect the exit dd if=/dev/rmt/0cn ibs=1024k of=/dev/null i need that the exit from that commando go to a log if a do this dd if=/dev/rmt/0cn ibs=1024k of=/dev/null > x.log don`t send me nothing to the log only in the screen. I need... (1 Reply)
Discussion started by: enkei17
1 Replies

6. Shell Programming and Scripting

awk{FIELDWIDTHS} replacing blanks with null

Hi, I am having a file and grabbed the contents of the field according to field widths. The command i used is: awk 'BEGIN{FIELDWIDTHS="10 25 20 14 6 10"}{print$4,$5,$6}' newtext.text >test1.txt i got the output for example: val1 val2 val3 <blank> ... (3 Replies)
Discussion started by: rish_max
3 Replies

7. Solaris

comand df -k

I need to know the available space in my unix. when making a df -k it shows me the following thing: /dev/vx/dsk/emc2/vol06 136764867 121542767 1545614 99% /emc06 would need them to explain to me well the command. since under the column avail the resulting value is... (2 Replies)
Discussion started by: roviedo
2 Replies

8. Shell Programming and Scripting

Testing a comand in the script

Hi everyone , i am new to shell scripting and am having some problem to test if this line has been executed well and display a pass message on the screen or fail if not sqlplus XXTEST/$2 <<END > $XXTEST_TOP/log/$0.log @$XXTEST_TOP/admin/sql/XXTEST_SPE1_XX_QUOTE_DETAILS_TBL.sql XXTEST$2... (2 Replies)
Discussion started by: Lutchumaya
2 Replies

9. UNIX for Dummies Questions & Answers

exec comand

hi, i have written a small script in which i use exec command and redriect output to a file..after sometime i want to switch it off and redirect the output to screen..how to do it exec >> /tmp/out.txt 2>&1 //set of statements then i want to switch of these exec as the rest should get... (5 Replies)
Discussion started by: mkan
5 Replies

10. UNIX for Dummies Questions & Answers

mount comand

Dear experts: I am installing software on Unix via telnet using CD on my NT workstation. What kind of NFS & mount comands I should run in the beginning ? (what exactly should be <drive for cdrom> and <mount ditectory> in the mount comand? Thanks in advance, etc.. (6 Replies)
Discussion started by: lostam
6 Replies
Login or Register to Ask a Question