Sponsored Content
Top Forums Shell Programming and Scripting count characters in specific records Post 302284231 by otheus on Thursday 5th of February 2009 04:10:39 AM
Old 02-05-2009
Each payload ends with something like "HTTP/1.1 200 OK" and the next one starts with Date:

So you could do something like this:
Code:
awk /^Content-Type: /,/^Date: / && /GMT$/ { packet++; count+=length($0); } /^Server: / { print "Packet " packet, "payload size",count; count=0; } END { print count; }

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count No of Records in File without counting Header and Trailer Records

I have a flat file and need to count no of records in the file less the header and the trailer record. I would appreciate any and all asistance Thanks Hadi Lalani (2 Replies)
Discussion started by: guiguy
2 Replies

2. Shell Programming and Scripting

Awk to Count Records with not null

Hi, I have a pipe seperated file I want to write a code to display count of lines that have 20th field not null. nawk -F"|" '{if ($20!="") print NR,$20}' xyz..txt This displays records with 20th field also null. I would like output as: (4 Replies)
Discussion started by: pinnacle
4 Replies

3. UNIX for Dummies Questions & Answers

Unix command to count the number of files with specific characters in name

Hey all, I'm looking for a command that will search a directory (and all subdirectories) and give me a file count for the number of files that contain specific characters within its filename. e.g. I want to find the number of files that contain "-a.jpg" in their name. All the searching I've... (6 Replies)
Discussion started by: murphysm
6 Replies

4. UNIX for Dummies Questions & Answers

Grep specific records from a file of records that are separated by an empty line

Hi everyone. I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this: ID: 20 Name: X Age: 19 ID: 21 Name: Z ID: 22 Email: xxx@yahoo.com Name: Y Age: 19 I want to grep records that... (4 Replies)
Discussion started by: Atrisa
4 Replies

5. Shell Programming and Scripting

Script to count particular type of records

Hi, I have a huge file containing thousands of records which are of following pattern: TYPE1 { originNodeType : "IVR" originHostName : "AAIVR" originTransactionID : "01310559" originTimeStamp : "20110620192440+0530" hostName : "hhhh" voucher : '0'D rProfileID : "ZZZZ" Before {... (5 Replies)
Discussion started by: madhukar1anand
5 Replies

6. Shell Programming and Scripting

sed replacing specific characters and control characters by escaping

sed -e "s// /g" old.txt > new.txt While I do know some control characters need to be escaped, can normal characters also be escaped and still work the same way? Basically I do not know all control characters that have a special meaning, for example, ?, ., % have a meaning and have to be escaped... (11 Replies)
Discussion started by: ijustneeda
11 Replies

7. Shell Programming and Scripting

Can't figure out how to find specific characters in specific columns

I am trying to find a specific set of characters in a long file. I only want to find the characters in column 265 for 4 bytes. Is there a search for that? I tried cut but couldn't get it to work. Ex. I want to find '9999' in column 265 for 4 bytes. If it is in there, I want it to print... (12 Replies)
Discussion started by: Drenhead
12 Replies

8. Shell Programming and Scripting

Count specific characters at specific column positions

Hi all, I need help. I have an input text file (input.txt) like this: 21 GTGCAACACCGTCTTGAGAGG 50 21 GACCGAGACAGAATGAAAATC 73 21 CGGGTCTGTAGTAGCAAACGC 108 21 CGAAAAATGAACCCCTTTATC 220 21 CGTGATCCTGTTGAAGGGTCG 259 Now I need to count A/T/G/C numbers at each character location in column... (2 Replies)
Discussion started by: thienxho
2 Replies

9. Shell Programming and Scripting

Count records in a block

Hi, We have a file that has a structure like this: H10 1 2 3 D10 1 D20 1 2 3 D20 3 4 5 D20 4 5 6 D10 2 D20 1 2 3 D20 3 4 5 D20 4 5 6 S10 10 H10 1 2 3 D10 1 D20 1 2 3 D20 3 4 5 D20 4 5 6 D10 2 (2 Replies)
Discussion started by: jerome_rajan
2 Replies

10. UNIX for Beginners Questions & Answers

Find records with specific characters in 2 nd field

Hi , I have a requirement to read a file ( 5 fields , ~ delimited) and find the records which contain anything other than Alphabets, Numbers , comma ,space and dot . ie a-z and A-Z and 0-9 and . and " " and , in 2nd field. Once I do that i would want the result to have field1|<flag> flag can... (2 Replies)
Discussion started by: ashwin3086
2 Replies
ldns(3) 						     Library Functions Manual							   ldns(3)

NAME
ldns_pkt_set_flags, ldns_pkt_set_id, ldns_pkt_set_qr, ldns_pkt_set_aa, ldns_pkt_set_tc, ldns_pkt_set_rd, ldns_pkt_set_cd, ldns_pkt_set_ra, ldns_pkt_set_ad, ldns_pkt_set_opcode, ldns_pkt_set_rcode, ldns_pkt_set_qdcount, ldns_pkt_set_ancount, ldns_pkt_set_nscount, ldns_pkt_set_arcount, ldns_pkt_set_answerfrom, ldns_pkt_set_querytime, ldns_pkt_set_size, ldns_pkt_set_section_count, ldns_pkt_set_tsig- SYNOPSIS
#include <stdint.h> #include <stdbool.h> #include <ldns/ldns.h> bool ldns_pkt_set_flags(ldns_pkt *pkt, uint16_t flags); void ldns_pkt_set_id(ldns_pkt *p, uint16_t id); void ldns_pkt_set_qr(ldns_pkt *p, bool b); void ldns_pkt_set_aa(ldns_pkt *p, bool b); void ldns_pkt_set_tc(ldns_pkt *p, bool b); void ldns_pkt_set_rd(ldns_pkt *p, bool b); void ldns_pkt_set_cd(ldns_pkt *p, bool b); void ldns_pkt_set_ra(ldns_pkt *p, bool b); void ldns_pkt_set_ad(ldns_pkt *p, bool b); void ldns_pkt_set_opcode(ldns_pkt *p, ldns_pkt_opcode c); void ldns_pkt_set_rcode(ldns_pkt *p, uint8_t c); void ldns_pkt_set_qdcount(ldns_pkt *p, uint16_t c); void ldns_pkt_set_ancount(ldns_pkt *p, uint16_t c); void ldns_pkt_set_nscount(ldns_pkt *p, uint16_t c); void ldns_pkt_set_arcount(ldns_pkt *p, uint16_t c); void ldns_pkt_set_answerfrom(ldns_pkt *p, ldns_rdf *r); void ldns_pkt_set_querytime(ldns_pkt *p, uint32_t t); void ldns_pkt_set_size(ldns_pkt *p, size_t s); void ldns_pkt_set_section_count(ldns_pkt *p, ldns_pkt_section s, uint16_t x); void ldns_pkt_set_tsig(ldns_pkt *p, ldns_rr *t); DESCRIPTION
ldns_pkt_set_flags() sets the flags in a packet. pkt: the packet to operate on flags: ORed values: LDNS_QR| LDNS_AR for instance Returns true on success otherwise false ldns_pkt_set_id() Set the packet's id p: the packet id: the id to set ldns_pkt_set_qr() Set the packet's qr bit p: the packet b: the value to set (boolean) ldns_pkt_set_aa() Set the packet's aa bit p: the packet b: the value to set (boolean) ldns_pkt_set_tc() Set the packet's tc bit p: the packet b: the value to set (boolean) ldns_pkt_set_rd() Set the packet's rd bit p: the packet b: the value to set (boolean) ldns_pkt_set_cd() Set the packet's cd bit p: the packet b: the value to set (boolean) ldns_pkt_set_ra() Set the packet's ra bit p: the packet b: the value to set (boolean) ldns_pkt_set_ad() Set the packet's ad bit p: the packet b: the value to set (boolean) ldns_pkt_set_opcode() Set the packet's opcode p: the packet c: the opcode ldns_pkt_set_rcode() Set the packet's respons code p: the packet c: the rcode ldns_pkt_set_qdcount() Set the packet's qd count p: the packet c: the count ldns_pkt_set_ancount() Set the packet's an count p: the packet c: the count ldns_pkt_set_nscount() Set the packet's ns count p: the packet c: the count ldns_pkt_set_arcount() Set the packet's arcount p: the packet c: the count ldns_pkt_set_answerfrom() Set the packet's answering server p: the packet r: the address ldns_pkt_set_querytime() Set the packet's query time p: the packet t: the querytime in msec ldns_pkt_set_size() Set the packet's size p: the packet s: the size ldns_pkt_set_section_count() Set a packet's section count to x p: the packet s: the section x: the section count ldns_pkt_set_tsig() Set the packet's tsig rr p: the packet t: the tsig rr AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben. REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs. Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
ldns_pkt . And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl. 30 May 2006 ldns(3)
All times are GMT -4. The time now is 01:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy