Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Divide 2 columns of output for a recentage used. Post 302488762 by sswagner8839 on Tuesday 18th of January 2011 11:00:29 AM
Old 01-18-2011
Divide 2 columns of output for a recentage used.

Need some help finishing this one liner.

Code:
nas_pool -l | egrep -v name|grep -v "^$" | awk '{print $4}' | while read  line; do  echo $line ; nas_pool -size $line ; nas_pool -size $line |  egrep -ie 'avail|total' | awk '{print $3}' ; done

OUTPUT:
Code:
clar_r5_performance
id           = 3
name         =  clar_r5_performance
used_mb      = 82973979
avail_mb     = 6268081
total_mb     = 89242060
potential_mb = 3297876

6268081
89242060

clarata_archive
id            = 10
name         = clarata_archive
used_mb      = 51329037
avail_mb     = 3142277
total_mb     =  54471314
potential_mb = 0

3142277
54471314

I am trying to get the % used. so I need to take avail_mb / total_mb * 100 = total % used.
Can you help? Trying to keep it a one liner, if possible...

Thanks!


--
Moderator's Comments:
Mod Comment
Please use code tags when posting data and code samples!

Last edited by vgersh99; 01-18-2011 at 12:03 PM.. Reason: code tags, please!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

abt viewing all the columns in the output as it is..

Hi, How is it possible to get all the columns on the screen while v run a script.. Thr r abt 30 columns.. and whn i run the script the columns in the output r all messed up.. Please help.. Thanks.. RRVARMA (1 Reply)
Discussion started by: RRVARMA
1 Replies

2. Shell Programming and Scripting

Displaying Output in Columns

I'm writing a script to analyze the logs of an smtp relay machine and I'd like the final output to be displayed in columns showing results from the previous day, week, month, and 45 days. The problem I'm running into is that I can't figure out how to display the columns neatly so there is no... (1 Reply)
Discussion started by: jjamd64
1 Replies

3. Shell Programming and Scripting

want to print output if u have rows and columns

U have a file File 1 0.3 0.2 0.4 0.3 0.8 0.11 0.22 0.4 0.23 0.45 0.56 0.78 0.98 0.11 0.32 0.2 0.4 0.45 0.54 0.2 0.33 0.44 0.21 0.22 0.98 0.8 0.2 0.34 0.54 0.98 0.12 0.1 0.22 0.32 0.34 0.89 0.22 File 2 rows columns 3 1 2 3 4 2 5 ... (8 Replies)
Discussion started by: cdfd123
8 Replies

4. Shell Programming and Scripting

extract columns from command output

I need to extract information (for example, file owner, directory path, etc). However, the code below does not work? What is wrong? find /usr/local/www/apache22/data/dev/chown_test -ls for i in * do cut -f 1,2 "$i" | echo done (3 Replies)
Discussion started by: montana24
3 Replies

5. Shell Programming and Scripting

Formatting output in columns

I have a file which contains data in below format: nbkv28s MgmtReporting -> TradingDesk 1 nbkv28s RMBS -> Credits 178 nbkv28s RMBS -> PassThrough 96 nbkv28s RMBS -> Prepayment 111 nbkv28s RMBS -> RMBSHome 370 nbkv28s RMBS -> TradingStrategy 98 nbkvnze RMBS -> RMBSHome 85 nbkvugn GSF... (3 Replies)
Discussion started by: mohsin.quazi
3 Replies

6. Shell Programming and Scripting

Output columns needs to be aligned

Hi All I'm running a shell script and the output is something like: Col1 Col2 Col3 aaaa aaaaaaa aaaaa bbbbb bbbbb bbbbbb ccc cccccc ccccccc But I require the output to printed as given below: Col1 Col2 Col3 aaaa ... (4 Replies)
Discussion started by: nkamalkishore
4 Replies

7. Shell Programming and Scripting

Need to display the output of ls -l selected columns

Hello Friends, Hope you are doing well. I am writing a shell script to find out the log file which are not updated in last 1 hours. I've almost completed the script but need your help in formatting its outputs. Currently, the output of the script is like this(as a flat row): ... (3 Replies)
Discussion started by: singh.chandan18
3 Replies

8. Shell Programming and Scripting

Screen Output to Specific Columns

User with moderate experience: I run a script (my addiction is KSH) that reads a file and reports certain parameters back to the user on screen and also piped to a file. The file(s) I read is/are located under different directories, and is usually called the same thing. Sometimes not. For... (3 Replies)
Discussion started by: Brusimm
3 Replies

9. Shell Programming and Scripting

append an output file with two columns

Hi All, can you help me with this: grep XXX dir/*.txt|wc -l > newfile.txt - this put the results in the newfile.txt, but I want to add another column in the newfile.txt, string 'YYYYY', separated somehow, which corresponds on the grep results? For example grep will grep XXX dir/*.txt|wc -l >... (5 Replies)
Discussion started by: apenkov
5 Replies

10. Shell Programming and Scripting

Print output as columns

Normal grep is not working to get the output. Sample Input: newjob: abc command name: a=b+c newjob: bbc command name: c=r+v newjob:ddc newjob:kkc command name: c=l+g newjob:mdc newjob:ldc newjob:kjc command name: u=dl+g newjob:lkdc newjob:lksdc command name: o=udl+g (6 Replies)
Discussion started by: onesuri
6 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWgawk | +--------------------+-----------------+ |Interface Stability | Volatile | +--------------------+-----------------+ NOTES
Source for gawk is available on http://opensolaris.org. Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 11:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy