counting & printing record count

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

grinder182533

Thread Starter
Joined
Jun 1, 2009
Messages
72
Hi
I have a complex script which outputs a text file for loading to a db.
I now need to enhance this script so 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 ?
Many thanks in advance !
 
Joined
Sep 12, 2003
Messages
20,583
Hi grinder182533,

Correct me if I misunderstand your requirements, but lp only prints files, and if by the number of records in a "text file" you actually mean "the number of lines" in the text file, then you can issue the following command to count the number of lines in the file before you enter the text file as a data base entry:
$ cat textfile | wc -l
will count the number of lines in the textfile.

Is the textfile you load into the db actually - one record - in the db? If that is the case, then ignore the above example as it will not give you the number of records in the db. For that you will have to look up the db documentation used by the data base administrator and issue one of the commands related to administering the db to find out that information.

-- Tom
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top