how to get a file name & record count of csv file

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to get a file name & record count of csv file
# 1  
Old 02-29-2008
how to get a file name & record count of csv file

HI ,
I am new to shell scripting ,
I have a requirement that
I send a file for data quality ( original.csv) & i will be getting 4 files daily into a particular directory in return with cleansed data .
the files may be clean.csv,
unclean.csv ,
So now my requirement is to read the file name & record count of each file ,put the file name & record count into table(2 columns)

compare the no of records(record count) in the sent file to the total record count all incoming files.

Can any one help me out to how to get the file name & record count from CSV file .

Thanks ,
# 2  
Old 03-02-2008
Question Not truly sure what is being asked, but

names of files
> ls -l *.csv

number of lines
> wc -l *.csv

Are you trying to, in english
determine # lines in output file
receive four files back
for each
understand the name
determine number of lines
write report file (filename, record count)
add up record count for all returned files
report on original record count vs. total returned record count
# 3  
Old 03-06-2008
hi Joe,

yes , i have to read all the return files(4) ,the name & record count and put it into a table with
record count
as columns .

and have to cross check the total count of all return files and compare with the record count of the file .

basically i want to insert the
names of files
> ls -l *.csv

number of lines
> wc -l *.csv into the table columns

example: out file : ABCD 100
infile1 : ABCD1 40
infile2 : ABCD2 30
infile3 : ABCD3 10
infile4 : ABCD4 20

i have to do a record check after inserting into a table for the ABCD file
with Total count(ABCD1+ABCD2+ABCD3+ABCD4)

if the count matches i have to take the files for further process , if the count mismatch i have to reject the batch.

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CSV File:Filter duplicate records from column1 & another column having unique record

Hi Experts, I have csv file with 30, 40 columns Pasting just 2 column for problem description. Need to print error if below combination is not present in file check for column-1 (DocumentNumber) and filter columns where value in DocumentNumber field is same. For all such rows, the field... (7 Replies)
Discussion started by: as7951
7 Replies

2. Shell Programming and Scripting

Total record count of all the file present in a directory

Hi All , We need one help on the below requirement.We have multiple pipe delimited .txt file(around 100 .txt files) present on one directory.We need the total record count of all the files present in that directory without header.File format as below : ... (8 Replies)
Discussion started by: STCET22
8 Replies

3. Shell Programming and Scripting

Output first unique record in csv file

Hi, I have to output a new csv file from an input csv file with first unique value in the first column. input csv file color product id status green 102 pass yellow 201 hold yellow 202 keep green 101 ok green 103 hold yellow 203 ... (5 Replies)
Discussion started by: Chris LAU
5 Replies

4. UNIX for Dummies Questions & Answers

syntax for counting & printing record count

Hi I have a complex script which outputs a text file for loading into a db. I now need to enhance this script do that I can issue an ‘lp' command to show the count of the number of records in this file. Can anybody give me the necessary syntax ? (2 Replies)
Discussion started by: malts18
2 Replies

5. Shell Programming and Scripting

Get the file name file size record count a file

Hi I want to find file size and record count for a file in same line. Thanks (2 Replies)
Discussion started by: dgmm
2 Replies

6. Shell Programming and Scripting

Extract data from an XML file & write into a CSV file

Hi All, I am having an XML tag like: <detail sim_ser_no_1="898407109001000090" imsi_1="452070001000090"> <security>ADM1=????</security> <security>PIN1=????</security> <security>PIN2=????</security> ... (2 Replies)
Discussion started by: ss_ss
2 Replies

7. Shell Programming and Scripting

Split long record into csv file

Hi I receive a mainframe file which has very long records (1100 chars) with no field delimiters. I need to parse each record and output a comma delimited (csv) file. The record layout is fixed. If there weren't so many fields and records I would read the file into Excel, as a "fixed width"... (10 Replies)
Discussion started by: wvdeijk
10 Replies

8. Shell Programming and Scripting

Record count of a csv file

Hello Gurus, We have a requirement to count the valid number of records in a comma delimited file with double quotes. The catch here is..few records have a new line carriage within the double quotes,,say for ex:we have a file called accounts the record count is 4827..but the actual valid count... (5 Replies)
Discussion started by: ajaykk
5 Replies

9. UNIX for Dummies Questions & Answers

How to count the record count in an EBCDIC file.

How do I get the record count in an EBCDIC file on a Linux Box. :confused: (1 Reply)
Discussion started by: oracle8
1 Replies

10. UNIX for Dummies Questions & Answers

How to delete a record from a csv file

Hi Guys I have downloaded a table from oracle database in .csv format. it has many fields as Title, First Name, Last Name etc. I have to download distinct titles from database and now i have to check all those titles from data of First Name one by one. and then i have to delete matched record.... (1 Reply)
Discussion started by: Rajeev Agrawal
1 Replies
Login or Register to Ask a Question