Parsing problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Parsing problem
# 15  
Old 04-21-2011
No ouput from zaxxon

Works for vgersh99 (with awk. nawk N/A)

---------- Post updated at 03:44 PM ---------- Previous update was at 03:41 PM ----------

So if I include my bdf_rep script, complete commands is:
Code:
#!/usr/bin/sh
bdf |sed -e 's/^\/[^ ]* //' -e 's/^[ \t]*//' | grep -v -e "Filesystem" -e /dev |tr -s ' ' | awk '{printf("%-22s%-12s%-12s%-10s%-20s\n",$1/1024,$2/1024,$3/1024
,$4,$5,$6)}' | sort -n -r -k 4 | awk '$NF ~ "RawData$" {print $(NF-1)+0}'

:-)
# 16  
Old 04-21-2011
Just for completeness, it works for me:
Code:
$> cat infile
TOTAL SIZE (MB)       USED (MB)   FREE (MB)   USAGE     FILESYSTEM
138048                116729      21319.5     85%       /RawData
9000                  2774.99     6179.58     31%       /var
193632                116719      76399.8     60%       /RawData2
780.68                52.4531     650.156     7%        /stand
$> awk '$NF ~ /RawData$/ {sub(/%/,"",$4); print $4}' infile
85

Anyhow, you got a solution from vgersh99.
# 17  
Old 04-21-2011
Quote:
Originally Posted by drbiloukos
No ouput from zaxxon

Works for vgersh99 (with awk. nawk N/A)

---------- Post updated at 03:44 PM ---------- Previous update was at 03:41 PM ----------

So if I include my bdf_rep script, complete commands is:
Code:
#!/usr/bin/sh
bdf |sed -e 's/^\/[^ ]* //' -e 's/^[ \t]*//' | grep -v -e "Filesystem" -e /dev |tr -s ' ' | awk '{printf("%-22s%-12s%-12s%-10s%-20s\n",$1/1024,$2/1024,$3/1024
,$4,$5,$6)}' | sort -n -r -k 4 | awk '$NF ~ "RawData$" {print $(NF-1)+0}'

:-)
most likely you don't need so many piped filters. What you're after can easily be done with a single awk (saving on CPU and the confusion).
# 18  
Old 04-21-2011
Display FS whose theshold exceed or equal 80

Code:
$ ./bdf_rep.sh | awk '$4+0>=80{print$5,$4+0}'
/RawData 85
/RawData2 100
/stand 95

Code:
$ ./bdf_rep.sh | awk '$4+0>=80{print$5,$4}' mdf
/RawData 85%
/RawData2 100%
/stand 95%

Code:
$ ./bdf_rep.sh | awk '$4+0>=80{print$5}' mdf
/RawData
/RawData2
/stand

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk parsing problem

Hello fellow unix geeks, I am having a small dilemna trying to parse a log file I have. Below is a sample of what it will look like: MY_TOKEN1(group) TOKEN(other)|SSID1 MY_TOKEN2(group, group2)|SSID2 What I need to do is only keep the MY_TOKEN pieces and where there are multiple... (7 Replies)
Discussion started by: dagamier
7 Replies

2. Shell Programming and Scripting

Problem parsing

Hi, I want to fetch a text.Clipping. ... (5 Replies)
Discussion started by: protocomm
5 Replies

3. Shell Programming and Scripting

Problem parsing args

Heya Tooltip: Parsing (getopts) for -u successfully sets mode=umnt, but case umnt is not executed, instead it either executes/show help or regular mount screen. I had copy pasted the structure of a getopts 'structure' from Man Page for getopts (posix Section 1) - The UNIX and Linux Forums... (1 Reply)
Discussion started by: sea
1 Replies

4. Shell Programming and Scripting

Parsing Problem

Hi all, I am having problems parsing the following file: cat mylist one,two,three four five,six My goal is to get each number on a seperate line. one two three four five six I tried this command: sed -e 's/\,/^M/g' mylist (11 Replies)
Discussion started by: rob11g
11 Replies

5. Shell Programming and Scripting

Parsing textfile problem with cut

Hi, I have a textfile with several lines like this: text num: USER text (num) num num I need all these stuff. Problem is, how to get these stuff after ":". USER is a username and all chars are possible, even whitespace. So I cant use cut. Any ideas? (3 Replies)
Discussion started by: mcW
3 Replies

6. Shell Programming and Scripting

Parsing problem

I need to parse a string which looks like "xyx","sdfsdf","asf_asdf" into var1="xyx" var2="sdfsdf" var3="asf_asdf" (3 Replies)
Discussion started by: Sushir03
3 Replies

7. Shell Programming and Scripting

Parsing problem

Hi, i need to parse a string which looks like this "xyz","1233","cm_asdfasdf" (2 Replies)
Discussion started by: Sushir03
2 Replies

8. Shell Programming and Scripting

Parsing problem

I need to separate out the contents in the string "xyz","1233","cm_asdfasdf" as xyz,1233,cm_asdfasdf Can anyone help me on this?? (1 Reply)
Discussion started by: Sushir03
1 Replies

9. Shell Programming and Scripting

awk parsing problem

I need help with a problem that I have not been able to figure out. I have a file that is about 650K lines. Records are seperated by blank lines, fields seperated by new lines. I was trying to make a report that would add up 2 fields and associate them with a CP. example output would be... (11 Replies)
Discussion started by: timj123
11 Replies

10. Shell Programming and Scripting

parsing problem with script

I'm trying to parse the variables out of a comma delimited expression, but i'm having trouble with script: num_var=1 while do a=`echo "a=7, b=8, c=9" | awk '{print $num_var}' | cut -d= -f2` b=`echo $a | cut -d, -f1` echo $b num_var=`expr $num_var + 1`... (5 Replies)
Discussion started by: mike@freddiemac
5 Replies
Login or Register to Ask a Question