row count


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users row count
# 1  
Old 02-10-2011
row count

Hi,
I want a row count of a file incliding header and trailer
If I do cat Filename | wc -l
then I am only getting the row count excluding the header and trailer
Buit I want the row count including Header and trailer
Please help

Many thanks in advance,
Pragyan
# 2  
Old 02-10-2011
Code:
wc -l filename

will give you the total number of lines of your file.

I suspect your "header" or "footer" are a just a "long" line so it is dispayed on multiple lines on your screen whereas in fact is it just 1 line (if you edit your file and jump from line to line to may get aware of it)

Do your file containes the header & footer ? ... or are they added afterward some how ?
# 3  
Old 02-10-2011
Row counts

No,there is no header and trailor as of now,we need to append to the existing file

Thanks
# 4  
Old 02-10-2011
Code:
cat header filename footer | wc -l

?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Row Count in .csv file

Hi, I have to find the count of rows starting with "E," in given a.csv file . Sample Data File. E,2333AED,A,MC3,25,31-MAY-18 E,2333AED,A,MC3,25,31-MAY-18 CYMC3 25AED 0000 E,2333CZK,A,MC3,25,31-MAY-18 CYMC3 25CZK 0000 E,2333EUR,A,MC3,25,31-MAY-18... (3 Replies)
Discussion started by: Prabhakar Y
3 Replies

2. Shell Programming and Scripting

Count the number or row with same value in a column

This is the source file, we called it errorlist.out 196 server_a server_unix_2 CD 196 server_b server_win_1 CD 196 server_c server_win_2 CD 196 server_bd server_unix_2 CD 196 server_d server_unix_2 CD 196 server_es server_win_1 CD 196 ... (14 Replies)
Discussion started by: sQew
14 Replies

3. Shell Programming and Scripting

To count distinct fields in a row

I have . dat file which contains data in a specific format: 0 3 892 921 342 1 3 921 342 543 2 4 817 562 718 765 3 3 819 562 717 761 i need to compare each field in a row with another field of the same column but different row and cont the... (8 Replies)
Discussion started by: Abhik
8 Replies

4. Shell Programming and Scripting

Count the delimeter from a file and delete the row if delimeter count doesnt match.

I have a file containing about 5 million rows, in the file there are some records which has extra delimiter at random position. (we dont know the positions), now we have to Count the delimeter from each row and if the count of delimeter is not matching then I want to delete those rows from the... (5 Replies)
Discussion started by: Akumar1
5 Replies

5. Shell Programming and Scripting

count identical strings print last row and count

I have a sorted file like: Apple 3 Apple 5 Apple 8 Banana 2 Banana 3 Grape 31 Orange 7 Orange 13 I'd like to search $1 and if $1 is not the same as $1 in the previous row print that row and print the number of times $1 was found. so the output would look like: Apple 8 3 Banana... (2 Replies)
Discussion started by: dcfargo
2 Replies

6. Shell Programming and Scripting

count number of nonempty columns in row

Hi, Suppose i have a inputfile in csv format. How to use awk to count 'the number of nonempty columns in each row' minus one, and add the value as a new column in the end For cosmetic reason, it's even better to include a descriptive label for the last column in the first row. for... (2 Replies)
Discussion started by: grossgermany
2 Replies

7. Shell Programming and Scripting

row count of 60 files in one file

hi all plz some unix guy help me in this i have 60 files which will have some records i want to find the total number of records in all the 60 files like file1 has 60 and file2 has 70 record i want to sum all these and find total row count in 60 files (5 Replies)
Discussion started by: er_zeeshan05
5 Replies

8. Shell Programming and Scripting

script to take row count

hi i am pretty new to unix .i am ETL guy I need a unix script to take row count of a file and write it to another file the problem with wc-l is it include filename also wc -l abc.dat will give me like 1000 abc.dat i just want 1000 to be written can u just take 2 min to write a simple... (5 Replies)
Discussion started by: er_zeeshan05
5 Replies

9. UNIX for Dummies Questions & Answers

row count but only number part

hi i am pretty new to unix .i am ETL guy I need a unix script to take row count of a file and write it to another file the problem with wc-l is it include filename also wc -l abc.dat will give me like 1000 abc.dat i just want 1000 to be written can u just take 2 min to write a simple... (1 Reply)
Discussion started by: er_zeeshan05
1 Replies

10. UNIX for Dummies Questions & Answers

row count of all files with more than 0 byte

Hi, Is there any way to get count number of lines in all files which have more than o bytes in current directory for example : in /user/sri/ there are 3 files abc 0 bytes def 5 bytes ghi 10 bytes i need to get wc -l for all files which have > 0 bytes at a time ..is... (6 Replies)
Discussion started by: sri2005
6 Replies
Login or Register to Ask a Question