row count but only number part


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers row count but only number part
# 1  
Old 10-22-2008
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 script for
# 2  
Old 10-22-2008
A starting point ...

Code:
wc -l < abc.dat

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reseting row count every given number of rows

I have a file with 48 rows. I am counting 6 rows and adding 6 to that number and repeating the operation, and then output the value in column 1. For the second column, I would like to get sort of a binary output (1s and 2s) every 3rd row. This is what I have: awk '{print ++src +... (1 Reply)
Discussion started by: Xterra
1 Replies

2. UNIX for Dummies Questions & Answers

I want count of number of records to be printed on each row.

we want the count of number of records to be printed on each row. For Ex: if there are 5 records on one unique id , the count "5'' should be printed on each record in other column. Please help for this. I am using unix & Cygwin. Below are sample records: KCZ0650473... (2 Replies)
Discussion started by: ElijaRajesh
2 Replies

3. Shell Programming and Scripting

Get row number from file1 and print that row of file2

Hi. How can we print those rows of file2 which are mentioned in file1. first character of file1 is a row number.. for eg file1 1:abc 3:ghi 6:pqr file2 a abc b def c ghi d jkl e mno f pqr ... (6 Replies)
Discussion started by: Abhiraj Singh
6 Replies

4. UNIX for Dummies Questions & Answers

Finding row number along with length of row

I have a fixed length file and I want to find out row number along with row length. I have a program that give me the line length if it satisfy the condition; but i would like to add row number as well? How do I do that? while IFS= read -r line; do if ; then echo ${line} echo... (8 Replies)
Discussion started by: princetd001
8 Replies

5. Shell Programming and Scripting

The difference between end number in the early row and the start number in the next

Hi Power User, I'm trying to compute this kind of text file format: file1: jakarta 100 150 jakarta 170 210 beijing 220 250 beijing 260 280 beijing 290 320 new_york 330 350 new_york 370 420 tokyo 430 470 tokyo 480 ... (2 Replies)
Discussion started by: anjas
2 Replies

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

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

8. Shell Programming and Scripting

how to add the number of row and count number of rows

Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count The input file: 21 2341 A 21 2341 A 21 2341 A 21 2341 C 21 2341 C 21 2341 C 21 2341 C 21 4567 A 21 4567 A 21 4567 C ... (6 Replies)
Discussion started by: juelillo
6 Replies

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

10. 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
Login or Register to Ask a Question