Sponsored Content
Top Forums Shell Programming and Scripting Specific Header after every 30 records Post 302592234 by srk409 on Monday 23rd of January 2012 10:22:38 AM
Old 01-23-2012
Specific Header after every 30 records

Hi All,

I have got a requirement.
I have a source file, EMPFULL.txt and I need to split the data for every 30 records
and place a Typical Header as below with system and page number too.
Code:
2012.01.03                    Employee Dept  Report                             1
...################################################################################
...# EmpNo   #Id/Number  #Deptid #Departmetname                                #Pro
...#
...################################################################################
Record1
Record2
.
.
Record30
2012.01.03                    Employee Dept  Report                             2
...################################################################################
...# EmpNo   #Id/Number  #Deptid #Departmetname                                #Pro
...#
...################################################################################
Record31
Record32
.
.
Record60
2012.01.03                    Employee Dept  Report                             3
...################################################################################
...# EmpNo   #Id/Number  #Deptid #Departmetname                                #Pro
...#
...################################################################################
.
.
.
.
.
2012.01.03                    Employee Dept  Report                             n
...################################################################################
...# EmpNo   #Id/Number  #Deptid #Departmetname                                #Pro
...#
...################################################################################

Here the number of records in Source file is dynamic.
Please help in this.

Cheers,
SRK
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to extract duplicate records with associated header record

All, I have a task to search through several hundred files and extract duplicate detail records and keep them grouped with their header record. If no duplicate detail record exists, don't pull the header. For example, an input file could look like this: input.txt HA D1 D2 D2 D3 D4 D4... (17 Replies)
Discussion started by: run_eim
17 Replies

2. 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

3. Shell Programming and Scripting

Renaming all header to specific header pattern

Input #HAC0253 EFVHIJHIJEFVTHIJOPKOPKTEFVEFVEFVOPKHIJOPKOPKHIJTTEFVEFVTEFV #BASFS12 EFVEFVHIJEFVEFVTOPKEFVOPKTHIJTTHIJOPK #ACG5115 TEFVEFVOIJEFVHIJHIJOPKOPKHIJHIJTTEFVEFVOPKTTEFVEFVOPKHIJOPKOPKOPK #ECG5114 IJTOPKHIJEFVOEFVEFVOPKTTEFVEFVOPKHIJOPKOPKOPK . . Output (5 Replies)
Discussion started by: patrick87
5 Replies

4. Shell Programming and Scripting

improve performance - replace $\| with $#@ and remove header and trailer records

Hi All, In my file i need to remove header and trailer records which comes in 1st line and last line respectively. After that i need to replace '$\|' with '$#@'. I am using sed command for this and its taking lot of time. Is there any other command which can be used to improve performance? ... (1 Reply)
Discussion started by: HemaV
1 Replies

5. 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

6. UNIX for Dummies Questions & Answers

pull date from header and append to all records

I did some searches, but couldn't really find what I'm looking for. I have a file formatted as below: BOF ABC CO - XYZ COMM DATA OF 07/05/2011 EBA00000001 sdfa rtyus uyml EBB00000001 54682 984w3 EBA00000002 mkiyuasdf 98234 I want to pull the date from the header record and add it... (4 Replies)
Discussion started by: keeferb
4 Replies

7. Shell Programming and Scripting

Adding Header and Trailer records to a appended file

How can we a shell script and pass date parameters .I have 3 files comming from Datastage with |" delimited I need append 3 files as above: File1: P0000|"47416954|"AU|"000|"INS|"0000|"|"20060601|"99991231|"|"|"|"|"01 File 2:... (2 Replies)
Discussion started by: e1994264
2 Replies

8. Shell Programming and Scripting

Copy header values into records

I'm using a shell script to manipulate a data file. I have a large file with two sets of data samples (tracking memory consumption) taken over a long period of time, so I have many samples. The problem is that all the data is in the same file so that each sample contains two sets of data.... (2 Replies)
Discussion started by: abercrom
2 Replies

9. Shell Programming and Scripting

Prefix a variable in the first column of all the records of the files with and without header

In a bash shell, I have to prefix a variable to two .CSV files File1.CSV and File2.CSV. One of the files has a header and the other one is with no header in the below format: "value11","value12","value13","value14","value15","value16" "value21","value22","value23","value24","value25","value26"... (7 Replies)
Discussion started by: dhruuv369
7 Replies

10. UNIX for Beginners Questions & Answers

Help in printing records where there is a 'header' in the first record ???

Hi, I have a backup report that unfortunately has some kind of hanging indent thing where the first line contains one column more than the others I managed to get the output that I wanted using awk, but just wanting to know if there is short way of doing it using the same awk Below is what... (2 Replies)
Discussion started by: newbie_01
2 Replies
Net::DNS::Header(3)					User Contributed Perl Documentation				       Net::DNS::Header(3)

NAME
Net::DNS::Header - DNS packet header SYNOPSIS
use Net::DNS; $packet = new Net::DNS::Packet; $header = $packet->header; DESCRIPTION
"Net::DNS::Header" represents the header portion of a DNS packet. METHODS
$packet->header $packet = new Net::DNS::Packet; $header = $packet->header; Net::DNS::Header objects emanate from the Net::DNS::Packet header() method, and contain an opaque reference to the parent Packet object. Header objects may be assigned to suitably scoped lexical variables. They should never be stored in global variables or persistent data structures. string print $packet->header->string; Returns a string representation of the packet header. string $packet->header->print; Prints the string representation of the packet header. id print "query id = ", $packet->header->id, " "; $packet->header->id(1234); Gets or sets the query identification number. A random value is assigned if the argument value is undefined. opcode print "query opcode = ", $packet->header->opcode, " "; $packet->header->opcode("UPDATE"); Gets or sets the query opcode (the purpose of the query). rcode print "query response code = ", $packet->header->rcode, " "; $packet->header->rcode("SERVFAIL"); Gets or sets the query response code (the status of the query). qr print "query response flag = ", $packet->header->qr, " "; $packet->header->qr(0); Gets or sets the query response flag. aa print "answer is ", $packet->header->aa ? "" : "non-", "authoritative "; $packet->header->aa(0); Gets or sets the authoritative answer flag. tc print "packet is ", $packet->header->tc ? "" : "not ", "truncated "; $packet->header->tc(0); Gets or sets the truncated packet flag. rd print "recursion was ", $packet->header->rd ? "" : "not ", "desired "; $packet->header->rd(0); Gets or sets the recursion desired flag. ra print "recursion is ", $packet->header->ra ? "" : "not ", "available "; $packet->header->ra(0); Gets or sets the recursion available flag. z Unassigned bit, should always be zero. ad print "The result has ", $packet->header->ad ? "" : "not", "been verified "; Relevant in DNSSEC context. (The AD bit is only set on answers where signatures have been cryptographically verified or the server is authoritative for the data and is allowed to set the bit by policy.) cd print "checking was ", $packet->header->cd ? "not" : "", "desired "; $packet->header->cd(0); Gets or sets the checking disabled flag. qdcount, zocount print "# of question records: ", $packet->header->qdcount, " "; Returns the number of records in the question section of the packet. In dynamic update packets, this field is known as "zocount" and refers to the number of RRs in the zone section. ancount, prcount print "# of answer records: ", $packet->header->ancount, " "; Returns the number of records in the answer section of the packet which may, in the case of corrupt packets, differ from the actual number of records. In dynamic update packets, this field is known as "prcount" and refers to the number of RRs in the prerequisite section. nscount, upcount print "# of authority records: ", $packet->header->nscount, " "; Returns the number of records in the authority section of the packet which may, in the case of corrupt packets, differ from the actual number of records. In dynamic update packets, this field is known as "upcount" and refers to the number of RRs in the update section. arcount, adcount print "# of additional records: ", $packet->header->arcount, " "; Returns the number of records in the additional section of the packet which may, in the case of corrupt packets, differ from the actual number of records. In dynamic update packets, this field is known as "adcount". EDNS Protocol Extensions do print "DNSSEC_OK flag was ", $packet->header->do ? "not" : "", "set "; $packet->header->do(1); Gets or sets the EDNS DNSSEC OK flag. Extended rcode EDNS extended rcodes are handled transparently by $packet->header->rcode(). UDP packet size $udp_max = $packet->header->size; $udp_max = $packet->edns->size; EDNS offers a mechanism to advertise the maximum UDP packet size which can be assembled by the local network stack. UDP size advertisement can be viewed as either a header extension or an EDNS feature. Endless debate is avoided by supporting both views. edns $header = $packet->header; $version = $header->edns->version; @options = $header->edns->options; $option = $header->edns->option(n); $udp_max = $packet->edns->size; Auxiliary function which provides access to the EDNS protocol extension OPT RR. COPYRIGHT
Copyright (c)1997-2002 Michael Fuhr. Portions Copyright (c)2002-2004 Chris Reinhardt. Portions Copyright (c)2012 Dick Franks. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl, Net::DNS, Net::DNS::Packet, Net::DNS::RR::OPT RFC 1035 Section 4.1.1 perl v5.18.2 2014-01-16 Net::DNS::Header(3)
All times are GMT -4. The time now is 01:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy