Sponsored Content
Top Forums UNIX for Dummies Questions & Answers AWK ??-print for fields within records in a file Post 302258431 by hyennah on Friday 14th of November 2008 02:36:39 PM
Old 11-14-2008
zaxxon, I was trying for something similar and gave a simplified example to show what I needed.I actually am doing something like this ,I am not getting the needed output..could you help me on this. Thank you

Input file:

A
TPS REPORT SOME OTHER DATA

abc def ghi
jkl mon pqr
stu vrs lll

END OF TPS REPORT

A
TPS REPORT SOME OTHER DATA

field1 field2 field3
field4 field5 field6

END OF TPS REPORT


Output needed:

Considering evrything between TPS REPORT & END OF TPS REPORT as a record,
I need first field of first line and second field of second line for each record as output.For the ipfile above, desired output is as follows:

abc mon
field1 field5
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print records which do not have expected number of fields in a comma delimited file

Hi, I have a comma (,) delimited file, in which few fields are enclosed with in double quotes " ". I have to print the records in the file which donot have expected number of field with the line number. File1 ==== name,desgnation,doj,project #header#... (7 Replies)
Discussion started by: machomaddy
7 Replies

2. UNIX for Dummies Questions & Answers

keeping last record among group of records with common fields (awk)

input: ref.1;rack.1;1 #group1 ref.1;rack.1;2 #group1 ref.1;rack.2;1 #group2 ref.2;rack.3;1 #group3 ref.2;rack.3;2 #group3 ref.2;rack.3;3 #group3 Among records from same group (i.e. with same 1st and 2nd field - separated by ";"), I would need to keep the last record... (5 Replies)
Discussion started by: beca123456
5 Replies

3. Shell Programming and Scripting

How to print 1st field and last 2 fields together and the rest of the fields after it using awk?

Hi experts, I need to print the first field first then last two fields should come next and then i need to print rest of the fields. Input : a1,abc,jsd,fhf,fkk,b1,b2 a2,acb,dfg,ghj,b3,c4 a3,djf,wdjg,fkg,dff,ggk,d4,d5 Expected output: a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Discussion started by: 100bees
6 Replies

4. UNIX for Dummies Questions & Answers

Make all records with the same number of fields (awk)

Hi, input: AA|BB|CC DD|EE FF what I am trying to get: AA|BB|CC DD|EE| FF|| I tried to create first an UDF for printing repeats, but I think I have an issue with my END section or my array: function repeat(str, n, rep, i) { for(i=1 ;i<n;i++) rep=rep str return rep } ... (6 Replies)
Discussion started by: beca123456
6 Replies

5. Shell Programming and Scripting

awk sort based on difference of fields and print all fields

Hi I have a file as below <field1> <field2> <field3> ... <field_num1> <field_num2> Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields. I tried this and it doesn't sort on the difference field .. Appreciate your help. cat... (9 Replies)
Discussion started by: newstart
9 Replies

6. Shell Programming and Scripting

awk print even fields of file

Hello: I want to print out the even number of fields plus the first column as row identifiers. input.txt ID X1 ID X2 ID X3 ID X4 A 700 A 1200 A 400 A 1300 B 2000 B 1000 B 2000 B 600 C 1400 C 200 C 1000 C 1200 D 1300 D 500 D 600 D 200and the output is: output.txt ID X1 X2 X3... (3 Replies)
Discussion started by: yifangt
3 Replies

7. Shell Programming and Scripting

awk to print line is values between two fields in separate file

I am trying to use awk to find all the $3 values in file2 that are between $2 and $3 in file1. If a value in $3 of file2 is between the file1 fields then it is printed along with the $6 value in file1. Both file1 and file2 are tab-delimited as well as the desired output. If there is nothing to... (4 Replies)
Discussion started by: cmccabe
4 Replies

8. UNIX for Beginners Questions & Answers

Match Fields between two files, print portions of each file together when matched in ([g]awk)'

I've written an awk script to compare two fields in two different files and then print portions of each file on the same line when matched. It works reasonably well, but every now and again, I notice some errors and cannot seem to figure out what the issue may be and am turning to you for help. ... (2 Replies)
Discussion started by: jvoot
2 Replies

9. UNIX for Beginners Questions & Answers

Awk: group multiple fields from different records

Hi, My input looks like that: A|123|qwer A|456|tyui A|456|wsxe B|789|dfgh Using awk, I am trying to get: A|123;456|qwer;tyui;wsxe B|789|dfgh For records with same $1, group all the $2 in a field (without replicates), and all the $3 in a field (without replicates). What I have tried:... (6 Replies)
Discussion started by: beca123456
6 Replies

10. UNIX for Beginners Questions & Answers

awk for matching fields between files with repeated records

Hello all, I am having trouble with what should be an easy task, but seem to be missing something fundamental. I have two files, with File 1 consisting of a single field of many thousands of records. I also have File 2 with two fields and many thousands of records. My goal is that when $1 of... (2 Replies)
Discussion started by: jvoot
2 Replies
OPENLOAD(1)						      General Commands Manual						       OPENLOAD(1)

NAME
openload - Tool for load testing of web applications SYNOPSIS
openload [options] url [clients] DESCRIPTION
This manual page documents briefly the openload usage. This manual page was written for the Debian distribution because the original program does not have a manual page. openload is (currently) a commandline tool, easy to use and providing near real-time performance measurements of the application under test which is very usefull during optimizations. OPTIONS
openload uses the usual GNU command line syntax, but the options starting with one dash (`-'). To run this program it is necessary to set the PATH or URL under test. You can set the clients number after the URL, which is the number of simultanous clients to simulate, defaults to 5. A summary of options is included below. -t Test mode: No throughput measurements are done. However the full response from the webserver (including headers) is displayed. This is useful for verifying that you get the right content before executing the real test. In this mode the number of clients defaults to 1. -h Header value: Specifies a HTTP request header. You can use this option several times to specify several headers. The sentence is -h followed by the name of header and the quoted value, separated by spaces. E.g. openload -h User-Agent "MSIE 5.0" mysite.com -l Time limit: number of seconds. The test will only run for the specified number of seconds. The sentence is -l followed by number of seconds, separated by spaces. E.g. openload -l 10 mysite.com -o Output mode: Currently only CSV (comma seperated values) is supported. This is useful for importing the result in a spreadsheet. The fields are: Url, Number of clients, TPS (Transactions Per Second), Average response time (seconds), Maximum response time, Total number of requests. -v Verifier mode: (undocumented) -b Body request: The test just request body response from the test URL. E.g. openload -b mysite.com OUTPUT RESULTS
A description of output results is listing below. * MaTps: a 20 second moving average of TPS. * Tps: (Transactions Per Second) is the number of completed requests during that second. * Resp Time: the average response time in seconds for the elapsed second. * Err: the percentage of responses that was erronous, i.e. didn't return a HTTP 200 Ok staus. * Count: the total number of completed requests. * Total TPS is the average TPS for the whole run, i.e. (Total completed requests) / (Total elapsed time). * Avg. Response time: the overall average response time in seconds. * Max Response time: the highest response time during this run. ABORTING THE PROCESS
To abort the process just press Enter or return Key, or use the terminal interrupt key (usually Ctrl-C). SEE ALSO
For a complete description of data results see the README file. AUTHOR
openload was written by Pelle Johnsen <pelle.johnsen@mail.dk>. This manual page was written by Silvia Alvarez <sils@powered-by-linux.com>, for the Debian project (but may be used by others). January 29, 2007 OPENLOAD(1)
All times are GMT -4. The time now is 05:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy