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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Count No of Records in File without counting Header and Trailer Records
# 1  
Old 06-07-2007
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  
Old 06-07-2007
Guiguy,
Please, include all relevant information, such as a sample of
the file and tell us what is "header" and what is "trailer", so
that we may be able to help you.
# 3  
Old 06-07-2007
it depends on how your file format is, usually, header and trailer make up 2 records..
so you can just wc -l and then minus 2 .

Last edited by ghostdog74; 06-07-2007 at 01:22 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Separate records of a file on 2 types of records

Hi I am new to shell programming in unix Please if I can provide help. I have a file structure of a header record and "N" detail records. The header record will be the total number of detail records I need to split the file in 2: One for the header Another for all detail records Could... (1 Reply)
Discussion started by: jamcogar
1 Replies

2. Shell Programming and Scripting

How to count dup records in file?

Hi Gurus, I need to count the duplicate records in file file abc abc def ghi ghi jkl I want to get below result: abc ,2 abc, 2 def ,1 ghi ,2 ghi, 2 jkl ,1 or abc ,2 def ,1 (3 Replies)
Discussion started by: ken6503
3 Replies

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

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

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

6. Shell Programming and Scripting

Header as is.. trailer count

i have .DAT file FILE1.DAT 1200910270040625 2123456789 J123456 ABC 2123456789 K123456 ABC 2222222222 L123456 DEF 2333333333 M12345 GHI 30000004 My outfile FILE2.TXT should have like this, I need the header value as ie (1200910270040625 ) body rows remove the duplicate rows and the... (2 Replies)
Discussion started by: kshuser
2 Replies

7. Shell Programming and Scripting

Help me in counting records from file

Hi, Please help me in counting the below records(1st field) from samplefile: Expected output: Count Descr ------------------------------------------- 7 Mean manager 14 ... (7 Replies)
Discussion started by: prashant43
7 Replies

8. Shell Programming and Scripting

Merge text files while combining the multiple header/trailer records into one each.

Situation: Our system currently executes a job (COBOL Program) that generates an interface file to be sent to one of our vendors. Because this system processes information for over 100,000 employees/retirees (and growing), we'd like to multi-thread the job into processing-groups in order to... (4 Replies)
Discussion started by: oordonez
4 Replies

9. UNIX for Dummies Questions & Answers

Count records in a zip file

Hello, I searched the forums on the keywords in the title I used above, but I did not find the answer: Is it possible to count records in a .zip file on an AIX machine if i don't have pkunzip installed? From all the research I'm reading in google and the reading of pkunzip in Unix.com,... (3 Replies)
Discussion started by: tekster757
3 Replies

10. Shell Programming and Scripting

grep all records in a file and get a word count -perl

Hi, I have a file .. file.txt .. i need to get a total record count in the files into a $variable.. im using perl script thanks (4 Replies)
Discussion started by: meghana
4 Replies
Login or Register to Ask a Question