syntax for counting & printing record count


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers syntax for counting & printing record count
# 1  
Old 01-13-2011
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  
Old 01-13-2011
Sorry....I do not fully understand...
I was under the impression that "lp" was to print files to a printer...
Are you after "wc -l" to get the line count ?
# 3  
Old 01-13-2011
Hi citaylor

Lets say my file contents look like this :-
abc|def|ghi
123/456|789
mno|pqr|stu
987|654|321

I want my script to be able to print the following line to an attached unix printer :

"4 records updated to database", (with the date and time included if possible).

Sorry if I wasn't clear in my earlier post !
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Counting elements in each record

Hello, I have a file such as below: 0 0 . . 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 1I want to count the number of 0 and 1 in each line (. represents no data) and print them into two columns, that is:... (3 Replies)
Discussion started by: Homa
3 Replies

2. Shell Programming and Scripting

[AWK script]Counting the character in record and print them in condition

.......... (1 Reply)
Discussion started by: Antonlee
1 Replies

3. Shell Programming and Scripting

counting particular record format in a file using AWK

I am trying to count records of particular format from a file and assign it to a variable. I tried below command br_count=wc -l "inputfile.dat"| awk -F"|" '{if (NF != "14") print }' but I amnot able to get it done. Please share me some idea how to get it done. Thanks in advance (7 Replies)
Discussion started by: siteregsam
7 Replies

4. Shell Programming and Scripting

Help with awk array syntax & counting script

..... (3 Replies)
Discussion started by: elbee11
3 Replies

5. Shell Programming and Scripting

Help in counting the no of repeated words with count in a file

Hi Pls help in solving my doubt.Iam having file like below file1.txt priya jenny jenny priya raj radhika priya bharti bharti Output required: I need a output like count of repeated words with name for ex: priya 3 jenny 2 (4 Replies)
Discussion started by: bha148
4 Replies

6. UNIX for Dummies Questions & Answers

Counting no. of lines and printing it at the start of the file

Dear users, I need to count the number of lines in a simple text file and print the number on the first line of that same file. I know I can count the lines using wc -l file.txt this gives for example 100 file.txt I need the number 100 to be printed at the very top of file.txt... (2 Replies)
Discussion started by: jenjen_mt
2 Replies

7. Red Hat

Counting columns in a delimited record with NULLs

I am trying to count the number of columns in a delimited flat file. The record is tab delimited. When I use the command wc -w, I am getting unexpected results when the record contains a NULL value. I believe it is because there is a "word" missing. The below example will return 4 words... (2 Replies)
Discussion started by: nmalencia
2 Replies

8. Shell Programming and Scripting

replaying a record count with another record count

i use unix command to take the record count for a file1 awk 'END{print NR}' filename i already have a file2 which conatin the count like ... .. rec_cnt=100 .. .. I want to replace the record in the file2 using the record i take from file1. suggest me some simple ways of doing it... (2 Replies)
Discussion started by: er_zeeshan05
2 Replies

9. UNIX for Dummies Questions & Answers

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 , ... (2 Replies)
Discussion started by: sirik
2 Replies

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