Sponsored Content
Full Discussion: grep & awk
Top Forums Shell Programming and Scripting grep & awk Post 302349836 by *Jess* on Wednesday 2nd of September 2009 03:25:24 AM
Old 09-02-2009
grep & awk

Hi all,

I'm figuring on how to grep only specific data I want below:

Bin Total %
----- ------- -----
1 15 42.9

Bin Total %
----- ------- -----
2 15 80

Bin Total %
----- ------- -----
3 20 80

I would only want the % which is 42.9 on bin 1, to output this 42.9 into a txt file.

By using awk '{print $3}' > abc.txt it displays the entire column 3. Appreciate any help. Thanks in advance!
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk: Version && nextfile

How can I find which version of Awk is installed? OpSystem is HPUX 11.x I am getting an error when trying to use the keyword nextfile and I dont know why! (Well, I can only assume that I have am using a version of Awk that does not support nextfile. However, according to O'Reilly, nextfile is... (3 Replies)
Discussion started by: google
3 Replies

2. UNIX for Dummies Questions & Answers

tar & Grep together

Hi, I've got dozens of tar's with two files in each one, live_access_log & live_error_log (one tar for each day, backups). The probelm is i need to match a pattern in all of the archive_access_log files and output the line to a seperate file (All_access.log). I.e. I need to get details... (21 Replies)
Discussion started by: tom123
21 Replies

3. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

4. UNIX for Dummies Questions & Answers

Difference between grep, egrep & grep -i

Hi All, Please i need to know the difference between grep, egrep & grep -i when used to serach through a file. My platform is SunOS 5.9 & i'm using the korn shell. Regards, - divroro12 - (2 Replies)
Discussion started by: divroro12
2 Replies

5. Shell Programming and Scripting

awk & grep - check for a value and write sub-word

Hi people, I have a file status.txt: Following 6 ports are totally or partially unavailable: ------------------------------------------------------------ MOD LINK PORTNAMES STAT1 STAT2 STAT3 SYN TYPE ------------------------------------------------------------ 8 Pr37 ... (12 Replies)
Discussion started by: gc_sw
12 Replies

6. Shell Programming and Scripting

awk (gawk) grep & columns

Hi, I'm working with gawk (on DOS) today. A goal is: find a string for-instance '123', cut a line in two columns and write second one. The problem is: command line works OK, awk file doesn't. But I would like to work with file because there are many strings to find. input: line command: awk... (4 Replies)
Discussion started by: frajer
4 Replies

7. Shell Programming and Scripting

copying file information using awk & grep

Hi, TASK 1: I have been using this code to print the information of files kept at "/castor/cern.ch/user/s/sudha/forPooja" in some text file name FILE.txt. rfdir /castor/cern.ch/user/s/sudha/forPooja | grep data | awk '{print "rfio:///castor/cern.ch/user/s/sudha/forPooja/"$9}' > FILE.txt ... (6 Replies)
Discussion started by: nrjrasaxena
6 Replies

8. Shell Programming and Scripting

Using Grep & find & while read line in a script

Hello people! I would like to create one script following this stage I have one directory with 100 files File001 File002 ... File100 (This is the format of content of the 100 files) 2012/03/10 12:56:50:221875936 1292800448912 12345 0x00 0x04 0 then I have one... (0 Replies)
Discussion started by: Abv_mx81
0 Replies

9. Shell Programming and Scripting

awk Help: quick and easy question may be: How to use &&

Hi Guru's. I am trying to use to check if $5 is greater than 80 & if not 100, then to print $0 : awk '{ if ($5>80) && if ($5 != 100) print $0} But getting error: >bdf1|sed 's/%//g'|awk '{ if ($5>80) && if ($5 != 100) print $0}' syntax error The source line is 1. The error... (6 Replies)
Discussion started by: rveri
6 Replies
Sys::Statistics::Linux::MemStats(3pm)			User Contributed Perl Documentation		     Sys::Statistics::Linux::MemStats(3pm)

NAME
Sys::Statistics::Linux::MemStats - Collect linux memory information. SYNOPSIS
use Sys::Statistics::Linux::MemStats; my $lxs = Sys::Statistics::Linux::MemStats->new; my $stat = $lxs->get; DESCRIPTION
Sys::Statistics::Linux::MemStats gathers memory statistics from the virtual /proc filesystem (procfs). For more information read the documentation of the front-end module Sys::Statistics::Linux. MEMORY INFORMATIONS
Generated by /proc/meminfo. memused - Total size of used memory in kilobytes. memfree - Total size of free memory in kilobytes. memusedper - Total size of used memory in percent. memtotal - Total size of memory in kilobytes. buffers - Total size of buffers used from memory in kilobytes. cached - Total size of cached memory in kilobytes. realfree - Total size of memory is real free (memfree + buffers + cached). realfreeper - Total size of memory is real free in percent of total memory. swapused - Total size of swap space is used is kilobytes. swapfree - Total size of swap space is free in kilobytes. swapusedper - Total size of swap space is used in percent. swaptotal - Total size of swap space in kilobytes. swapcached - Memory that once was swapped out, is swapped back in but still also is in the swapfile. active - Memory that has been used more recently and usually not reclaimed unless absolutely necessary. inactive - Memory which has been less recently used and is more eligible to be reclaimed for other purposes. On earlier kernels (2.4) Inact_dirty + Inact_laundry + Inact_clean. The following statistics are only available by kernels from 2.6. slab - Total size of memory in kilobytes that used by kernel for data structure allocations. dirty - Total size of memory pages in kilobytes that waits to be written back to disk. mapped - Total size of memory in kilbytes that is mapped by devices or libraries with mmap. writeback - Total size of memory that was written back to disk. committed_as - The amount of memory presently allocated on the system. The following statistic is only available by kernels from 2.6.9. commitlimit - Total amount of memory currently available to be allocated on the system. METHODS
new() Call "new()" to create a new object. my $lxs = Sys::Statistics::Linux::MemStats->new; It's possible to set the path to the proc filesystem. Sys::Statistics::Linux::MemStats->new( files => { # This is the default path => '/proc', meminfo => 'meminfo', } ); get() Call "get()" to get the statistics. "get()" returns the statistics as a hash reference. my $stat = $lxs->get; EXPORTS
No exports. SEE ALSO
proc(5) REPORTING BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>. AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>. COPYRIGHT
Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-03-09 Sys::Statistics::Linux::MemStats(3pm)
All times are GMT -4. The time now is 06:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy