The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to read record by record from a file in unix raoscb UNIX for Dummies Questions & Answers 1 05-16-2008 07:30 AM
Script to search a bad record in a file then put the record in the bad file shilendrajadon Shell Programming and Scripting 2 12-28-2007 10:02 AM
Script to search a bad record in a file then put the record in the bad file shilendrajadon UNIX for Advanced & Expert Users 1 12-28-2007 10:00 AM
splitting a record and adding a record to a file rsolap Shell Programming and Scripting 1 08-13-2007 02:58 PM
How to count the record count in an EBCDIC file. oracle8 UNIX for Dummies Questions & Answers 1 07-26-2006 08:22 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-29-2008
sirik sirik is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 2
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 ,
interrim.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 ,
SIRI
  #2 (permalink)  
Old 03-02-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
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
done
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 (permalink)  
Old 03-06-2008
sirik sirik is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 2
hi Joe,

yes , i have to read all the return files(4) ,the name & record count and put it into a table with
filename,
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
INFILES:
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.

Thanks
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0