Sponsored Content
Top Forums Shell Programming and Scripting Print record count of a file using shell script Post 302771252 by mmeda on Wednesday 20th of February 2013 05:23:43 AM
Old 02-20-2013
Print record count of a file using shell script

HI,

I need to print the record count of a file using shell script.

If the record count of a file excluding header and trailer record if greater than zero then print 'Record count of a file is xxxx records'.

If the record count is zero print 'zero records'


Thanks
Mahendra
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. Shell Programming and Scripting

shell script to get the arrival count of file

Hello All, I have come across a small problem. It would be great if any of you could help me in resolving the issue. one file named dummy.txt will be ftped to Unix machine twice daily. If i receive it second time in a day i need to do some processing with the file. How to find the... (2 Replies)
Discussion started by: RSC1985
2 Replies

5. Shell Programming and Scripting

How to assign record count output of isql to a shell variable ?

isql select count(*) from Table eof How to assign record count output of isql query to a shell variable ? (4 Replies)
Discussion started by: vikram3.r
4 Replies

6. Shell Programming and Scripting

Shell script for searching a record,copy to a file and then delete it

Hi, I have a requirement in hand: I have a file with millions of records say file 1.I have another file, say file 2 which has 2000 records in it. The requirement is to read file2 , and remove the read record from file 1 and move i to a seperate file, file 3. For eg: Read file 2, get the... (5 Replies)
Discussion started by: kumara2010
5 Replies

7. Shell Programming and Scripting

File Count Based on FileDate using Shell Script

I have file listed in my directory in following format -rwxrwxr-x+ 1 test test 4.9M Oct 3 16:06 test20141002150108.txt -rwxrwxr-x+ 1 test test 4.9M Oct 4 16:06 test20141003150108.txt -rwxrwxr-x+ 1 test test 4.9M Oct 5 16:06 test20141005150108.txt -rwxrwxr-x+ 1 test ... (2 Replies)
Discussion started by: krish2014
2 Replies

8. Shell Programming and Scripting

Shell script for field wise record count for different Files .csv files

Hi, Very good wishes to all! Please help to provide the shell script for generating the record counts in filed wise from the .csv file My question: Source file: Field1 Field2 Field3 abc 12f sLm 1234 hjd 12d Hyd 34 Chn My target file should generate the .csv file with the... (14 Replies)
Discussion started by: Kirands
14 Replies

9. Shell Programming and Scripting

Script Shell: Count The sum of numbers in a file

Hi all; Here is my file: V1.3=4 V1.4=5 V1.1=3 V1.2=6 V1.3=6 Please, can you help me to write a script shell that counts the sum of values in my file (4+5+3+6+6) ? Thank you so much for help. Kind regards. (3 Replies)
Discussion started by: chercheur111
3 Replies

10. 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
srec_emon52(5)							File Formats Manual						    srec_emon52(5)

NAME
srec_emon52 - Elektor Monitor (EMON52) file format DESCRIPTION
This format is used by the monitor EMON52, developed by the European electronics magazine Elektor (Elektuur in Holland). Elektor wouldn't be Elektor if they didn't try to reinvent the wheel. It's a mystery why they didn't use an existing format for the project. Only the Elektor Assembler will produce this file format, reducing the choice of development tools dramatically. Records All data lines are called records, and each record contains the following four fields: +---+------+---+-----------+------+ |cc | aaaa | : | dd ... dd | ssss | The field are defined as follows: +---+------+---+-----------+------+ cc The byte count. A two digit hex value (1 byte), counting the actual data bytes in the record. The byte count is separated from the next field by a space. aaaa The address field. A four hex digit (2 byte) number representing the first address to be used by this record. : The address field and the data field are separated by a colon. dd The actual data of this record. There can be 1 to 255 data bytes per record (see cc) All bytes in the record are separated from each other (and the checksum) by a space. ssss Data Checksum, adding all bytes of the data line together, forming a 16 bit checksum. Covers only all the data bytes of this record. Please note that there is no End Of File record defined. Byte Count The byte count cc counts the actual data bytes in the current record. Usually records have 16 data bytes. I don't know what the maximum number of data bytes is. It depends on the size of the data buffer in the EMON52. Address Field This is the address where the first data byte of the record should be stored. After storing that data byte, the address is incremented by 1 to point to the address for the next data byte of the record. And so on, until all data bytes are stored. The address is represented by a 4 digit hex number (2 bytes), with the MSD first. Data Field The payload of the record is formed by the Data field. The number of data bytes expected is given by the Byte Count field. Checksum The checksum is a 16 bit result from adding all data bytes of the record together. Size Multiplier In general, binary data will expand in sized by approximately 3.8 times when represented with this format. EXAMPLE
Here is an example of an EMON52 file: 10 0000:57 6F 77 21 20 44 69 64 20 79 6F 75 20 72 65 61 0564 10 0010:6C 6C 79 20 67 6F 20 74 68 72 6F 75 67 68 20 61 05E9 10 0020:6C 6C 20 74 68 69 73 20 74 72 6F 75 62 6C 65 20 05ED 10 0030:74 6F 20 72 65 61 64 20 74 68 69 73 20 73 74 72 05F0 04 0040:69 6E 67 21 015F SEE ALSO
http://sbprojects.fol.nl/knowledge/fileformats/emon52.htm AUTHOR
This man page was taken from the above Web page. It was written by San Bergmans <sanmail@bigfoot.com> Reference Manual SRecord srec_emon52(5)
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy