user3713876
user3713876

Reputation: 41

exact lines from text file with multiple sublines in linux

i am using UTL_FILE utility in oracle to get the data in to csv file.

sample of output in the test.csv file is

"sno","name"
"1","hari is in singapore
ramesh is in USA"
"2","pong is in chaina
chang is in malaysia
vilet is in uk"

now i am counting the number of records in the testr.csv by using linux commans as

awk 'END{print NR-1}' test.csv    

here i am getting the record count as

5      (ACCORDING TO LINUX)

but if i calculate the number of records by using select * from test;

 COUNT(*)
----------                 (ACCORDING TO DATA BASE)
        2

can any body help me how to count the exact lines in the test.csv file

thanks in advance.

Upvotes: 0

Views: 51

Answers (1)

salparadise
salparadise

Reputation: 5805

Couldn't just count the lines that start with a number?

egrep -c "^\"[0-9]" test.csv

output:

2

Upvotes: 1

Related Questions