Sponsored Content
Full Discussion: Refine awk
Top Forums Shell Programming and Scripting Refine awk Post 302459844 by Scott on Tuesday 5th of October 2010 01:04:02 PM
Old 10-05-2010
Sorry, I used $2, you wanted $5.

It should print only one line, not two, based on your df statement.

Code:
$ df -h /Volumes/share/ | awk 'NR-1 {print $5 + 0}'          
80

edit: Actually, in Linux (if that's what you're using) you might want to use the -P option to keep the output on one line

Last edited by Scott; 10-05-2010 at 02:12 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to refine results of grep -p

I need help to further reduce the output shown below. I want to be able to only return the paragraph where the 'Database alias' is exactly equal to DBIHP. I do not want the other paragraphs being shown below. $ echo $dbalias DBIHP $ db2 list db directory|grep -p 'Database alias ... (2 Replies)
Discussion started by: priceb
2 Replies

2. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

3. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

4. Shell Programming and Scripting

Problem with awk awk: program limit exceeded: sprintf buffer size=1020

Hi I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it The code is that: { if (NF==17){ print $0 }else{ fields=NF; all=$0; while... (2 Replies)
Discussion started by: fate
2 Replies

5. Shell Programming and Scripting

refine awk command in replacing carriage return

Hi, need your help in below,I have 4 types of file need to be processed so that it will replace carriage return in Remarks column with <:::> Remarks column position may varies in different types of file. sample file: col1|col2|col3|col4|col5|col6|col7|Remarks|col9|col10... (8 Replies)
Discussion started by: agathaeleanor
8 Replies

6. Shell Programming and Scripting

Sort a the file & refine data column & row format

cat file1.txt field1 "user1": field2:"data-cde" field3:"data-pqr" field4:"data-mno" field1 "user1": field2:"data-dcb" field3:"data-mxz" field4:"data-zul" field1 "user2": field2:"data-cqz" field3:"data-xoq" field4:"data-pos" Now i need to have the date like below. i have just... (7 Replies)
Discussion started by: ckaramsetty
7 Replies

7. Shell Programming and Scripting

awk command to compare a file with set of files in a directory using 'awk'

Hi, I have a situation to compare one file, say file1.txt with a set of files in directory.The directory contains more than 100 files. To be more precise, the requirement is to compare the first field of file1.txt with the first field in all the files in the directory.The files in the... (10 Replies)
Discussion started by: anandek
10 Replies

8. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

9. Shell Programming and Scripting

Passing awk variable argument to a script which is being called inside awk

consider the script below sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml awk -F'' '{for(i=1;i<=NF;i++){ if($i=="Alert id") { if(id!="") if(dt!=""){ cmd="sh someScript.sh... (2 Replies)
Discussion started by: vivek d r
2 Replies

10. Shell Programming and Scripting

awk output yields error: awk:can't open job_name (Autosys)

Good evening, Im newbie at unix specially with awk From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example 1. This is the inputfile: $ more MapaRep.txt ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies
LVSCAN(8)						      System Manager's Manual							 LVSCAN(8)

NAME
       lvscan - scan (all disks) for Logical Volumes

SYNOPSIS
       lvscan [-a|--all] [-b|--blockdevice] [-d|--debug] [-h|--help] [--ignorelockingfailure] [-P|--partial] [-v|--verbose]

DESCRIPTION
       lvscan  scans all known volume groups or all supported LVM block devices in the system for defined Logical Volumes.  The output consists of
       one line for each Logical Volume indicating whether or not it is active, a snapshot or origin, the size of the device  and  its	allocation
       policy.	Use lvs(8) or lvdisplay(8) to obtain more-comprehensive information about the Logical Volumes.

OPTIONS
       See lvm for common options.

       --all  Include information in the output about internal Logical Volumes that are components of normally-accessible Logical Volumes, such as
	      mirrors, but which are not independently accessible (e.g. not mountable).  For example, after creating a mirror using 'lvcreate  -m1
	      --mirrorlog disk', this option will reveal three internal Logical Volumes, with suffixes mimage_0, mimage_1, and mlog.

       -b, --blockdevice
	      This option is now ignored.  Instead, use lvs(8) or lvdisplay(8) to obtain the device number.

SEE ALSO
       lvm(8), lvcreate(8), lvdisplay(8) lvs(8)

Sistina Software UK					 LVM TOOLS 2.02.95(2) (2012-03-06)						 LVSCAN(8)
All times are GMT -4. The time now is 09:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy