Sponsored Content
Full Discussion: Validate record count
Top Forums Shell Programming and Scripting Validate record count Post 302376361 by tene on Tuesday 1st of December 2009 08:59:33 AM
Old 12-01-2009
noOfLines=`wc -l filename`
noOfFields=`cat filename | awk -F"|" '{print NF}'`

#If the file does not have 50 lines or it does not have 10 | delimited fields
# it will be moved to bad dir

if [ noOfLines -ne 50 ] || [ noOfFields -ne 10 ]
then
mailx abc@gmail.com < log
mv filename dest_dir
fi
 

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

Need help with Isql record count

What I am trying to do is check if the database query returned any records. If no records returned then output a message else output results to a file. Right now if I take out the if and else statements the code runs fine and sends the email. If no records returned the email sends the column... (4 Replies)
Discussion started by: johnu122
4 Replies

3. Shell Programming and Scripting

record count

i have a file named file_names.dat where there are several files along with their path. exp: /data1/dir1/CTA_ACD_20071208.dat /data1/dir1/CTA_DFG_20071208.dat i want to write a script which will create a csv file with the name of the file and record count of that file the output file... (4 Replies)
Discussion started by: dr46014
4 Replies

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

5. UNIX for Advanced & Expert Users

character count per record

Hello can someone please advise. I need to send records in a file that are over 10,000 characters long to a seperate file. Any ideas? Thanks (2 Replies)
Discussion started by: Dolph
2 Replies

6. Shell Programming and Scripting

Character count per record

I have a flat file. How can i retrive the character count per record in whole file. Can anybody assist me on this Cheers (9 Replies)
Discussion started by: subrat
9 Replies

7. UNIX for Dummies Questions & Answers

Reduce the count on the 98 record by 2,

recod,amount,noofaccount,count 98,+00000187865779787,00319,000000640/ 99,+00000187865779787,00001,000000642/ thsi is my input file my question is 1) Reduce the count on the 98 record by 2 (6 Replies)
Discussion started by: sgoud
6 Replies

8. Shell Programming and Scripting

count of record in files

Hi all, I have written a scripts which count number of lines in all the files in a directory and write in a text file. I don't know how to format it while writing. OS suns solaris 10 my scripts is as below for i in /ersdg3/ERS/ERS_INPUT_LOGS/RIO/LOGS/RIO_02-Aug-2012/ *.LOG do echo... (11 Replies)
Discussion started by: guddu_12
11 Replies

9. Shell Programming and Scripting

Validate file count in korn shell script

Hi, I have files in the directory like below which I need to validate if all the required files are present. A_B_001 of 002_time1.txt A_B_002 of 002_time1.txt A_B_001 of 001_time2.txt Scenarios- a)If file with 001 of 002_time1 or 002 of 002_time1 is missing in the folder,script should... (6 Replies)
Discussion started by: aneeta13
6 Replies

10. UNIX for Dummies Questions & Answers

Need record count on every 30 minute

We have the below records where we need record count of every 30 minute like 00:01 to 00:30 so in that we will have 48 record count in 24 hrs , and also we need sum of record count from 00:01 to 23:30. Please find sample data as well. 00:01 21 00:02 23 00:03 34 00:04 34 00:05 30... (10 Replies)
Discussion started by: nadeemrafikhan
10 Replies
PMUNPACKEVENTRECORDS(3) 				     Library Functions Manual					   PMUNPACKEVENTRECORDS(3)

NAME
pmUnpackEventRecords - unpack event records C SYNOPSIS
#include <pcp/pmapi.h> int pmUnpackEventRecords(pmValueSet *vsp, int idx, pmResult ***rap); cc ... -lpcp DESCRIPTION
Event records are encoded as a packed array of records within a pmResult using a container metric with a value of type PM_TYPE_EVENT. pmUnpackEventRecords may be used to unpack event records from a metric value identified by vsp and idx. If the metric has a singular value, idx should be 0, else the ordinal instance value identified by idx will be unpacked, i.e. vsp->vlist[idx]. The unpacked records are turned into pmResult structures, one per event record and one metric per event parameter, and rap is returned as a pointer to an array (NULL pointer terminated) of pointers to the pmResult structures. Some control information from the packed event records is unpacked into additional ``anonymous'' metrics as follows: 1. If the event record has a non-zero flags value, then the corresponding pmResult will have the flags value encoded with the additional metric event.flags that is inserted ahead of all other event parameters. 2. If the event record flag is set to PM_EVENT_FLAG_MISSED, then the corresponding pmResult will have one metric event.missed with a value that equals the number of event records ``missed'' because either the PMDA could not keep up, or the PMAPI client did not collect the event records fast enough. pmUnpackEventRecords returns the number of pmResult structures as the return value, which is >= 0 for success. rset and the associated pmResult structures may be freed using the convenience function pmFreeEventResult(3). RETURN VALUE
The following errors are possible: PM_ERR_CONV The values associated with vsp are not encoded using the format PM_VAL_DPTR or PM_VAL_SPTR, or the flags at the head of the event record has an unexpected value. PM_ERR_INST The value associated with vsp is not singular as expected. PM_ERR_TYPE vsp is not a value of type PM_TYPE_EVENT. PM_ERR_TOOSMALL The value identified by vbp is not legal because the value length is less than the minimum size, or the number of event records encoded in the (value header) pmEventArray structure is negative, or the number of missed event records in the pmEventArray array is negative. PM_ERR_TOOBIG Either vsp indicates more than one value is present (all the event records are expected to be packed in a single metric value), or when unpacking the event records, the processing continues past the end of the enclosing value. Indicates corruption of the packed event record. PM_ERR_TYPE Event parameters must have one of the arithmetic types, else PM_TYPE_AGGREGATE, PM_TYPE_STRING or PM_TYPE_AGGREGATE_STATIC. other values < 0 refer to pmErrStr(3). SEE ALSO
PMAPI(3) and pmFreeEventResult(3). Performance Co-Pilot PCP PMUNPACKEVENTRECORDS(3)
All times are GMT -4. The time now is 07:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy