Sponsored Content
Full Discussion: Measurement file parsing
Top Forums Shell Programming and Scripting Measurement file parsing Post 302629205 by yoda9691 on Tuesday 24th of April 2012 11:52:29 AM
Old 04-24-2012
Measurement file parsing

I have an application performance measurement file with one thousand lines. Each line has some text indicating type of measurement and the last field containing the measured value. Each of the file has a unique measurement. I am interested in only extracting about 100 of those measurements and put them in a comma delimited file. I have written a ksh script with multiple grep commands with each grep searching for a uniq pattern. This method opens same file over and over again but I am wondering if there is a better scripting method or something other than ksh script that would eliminate multiple greps.

Example of input file
Code:
some text indicating type of measure1 is here value
some other zdfg value
string indicating yet another abdf value
....
...
...
last line with cpu_use value

Here is what I have done to extract only the measure that I am interested in
Code:
Measure1=`grep measure1 file | awk '{print $NF}'`
zdfg=`grep zdfg file | awk '{print $NF}'`
cpu_use=`grep cpu_use file | awk '{print $NF}'`

and so on

Code:
echo $Measure1,$zdfg,$cpu_use

This gives me following output
Code:
value,value,value,value....

I am sure there a better and efficient way. Please suggest.

Last edited by radoulov; 04-24-2012 at 01:02 PM.. Reason: Code tags, please!
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Performance measurement of Code

I hope I am posting the query at right place.. I have the project running as 32 bit application on Solaris 8. I want to port this to 64Bit application. Before I start this process, I would like to compare the performance of a sample code running as 32Bit/64 Bit executables on a 64 bit... (1 Reply)
Discussion started by: amit_sapre
1 Replies

2. Programming

time measurement

I have a bottleneck in one of my applications...I have a loop that goes through a few thousand interations, but does quite a few things (digs info out of a database, sends the data to another application, etc...). I want to put in some debugging to determine what function calls are taking the most... (8 Replies)
Discussion started by: jalburger
8 Replies

3. UNIX for Dummies Questions & Answers

Commands performance measurement

Hi, Actually i wanted to check out the process time for the execution of commands on unix, i looking for the script which can include all commands which are to be executed on the system and i need to get the time for executing each command, can somebody help me Thanks & Regards Murali (1 Reply)
Discussion started by: hsmuralidhara
1 Replies

4. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

5. Shell Programming and Scripting

convert file storage size from one unit of measurement to another

The source number is always in megabytes and I need a script to covert into either MB,GB or TB displayed in a specific format. Source number examples: 5345376635 34255 5453645846353 The result has to be maximum 2 numbers after the comma 1.13 TB 134.17 TB 413.46 GB 678.45 MB I... (3 Replies)
Discussion started by: TehOne
3 Replies

6. IP Networking

SNMP OID for Network Utilization measurement

Hi everyone, I've just copied a snmpget script from somewhere. This script is basically used to collect basic router information. Ex: syscontact,syslocation,etc. And I want to extend the script to be able to collect some network information and utilization of some machines ex: bandwith usage,... (0 Replies)
Discussion started by: franzramadhan
0 Replies

7. IP Networking

OID for Bandwith and Throughput Measurement

Hey Guys, Does anybody know, which OID's of Net-SNMP is used to collect throughput and bandwith usage of machine?? I got these OID's ..iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifOutOctets ..1.3.6.1.2.1.2.2.1.16 ... (1 Reply)
Discussion started by: franzramadhan
1 Replies

8. UNIX for Advanced & Expert Users

Redhat - IO performance measurement

Hi Currently we have SAN setup in our Redhat Environment. I have used iostat tool and ran it couple of times, i think there is IO bottle neck. Can anyone suggest any other tools or help me how to perform multiple Reads/Writes to test its performance (1 Reply)
Discussion started by: rakeshkumar
1 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 03:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy