using awk to count no of records based on conditions
Hi
I am having files with date and time stamp as the folder names like 200906051400,200906051500,200906051600 .....hence everyday 24 files will be generated
i need to do certain things on this 24 files daily
file contains the data like
i need the scripts to do the following
1. It has to filter the records based on $4 and $6 (i.e $4==BSNLSERVICE1 AND $6==2128 ) and count the total records for the DAY (20090605*)
OUTPUT REQUIRED:
BSNLSERVICE1 2128 ==3
2. It has to filter the records based on $4 and $6 (i.e $4==BSNLSERVICE1 AND $6==2128) and count the total records for the DAY (20090605*) AND GROUP BASED ON $14 (i.e SUCCESS, FAILURE)
3. It has to filter the records based on $4 and $6 (i.e $4==BSNLSERVICE1 AND $6==2128), GROUP BASED ON $9 (i.e 919448010098, 919446001618 ) and count the total records for the DAY (20090605*) FOR EACH DISTINCT $9
OUTPUT REQUIRED:
919449838266 2
919448010097 1
output should be of $4==BSNLSERVICE1 AND $6==2128 only ..other things ($4==RTMS) are not required.
Help me out pls
Last edited by aemunathan; 06-05-2009 at 09:33 AM..
To get the date of yesterday you can use the datecalc script of Perderabo.
Place this script in the same directory of your script with the name datecalc and make it executable:
I need one more info. actually am using sqlloader to insert the result in to a table. Here i want to print the previous date as well in dd-mon-yyyy format
i tried in this way
Help me out !!!! the report is of previous day so i need to use the previous date while printing.
Thanks in advance
Last edited by aemunathan; 06-07-2009 at 02:36 PM..
Reason: one more requirement!!!!!!
I have been reading old posts and trying to come up with a solution for the below: Use a tab-delimited input file to assign
point to variables that are used to update a specific field, Rank. I really couldn't find too much in the way of assigning points
to variable, but made an attempt at an awk... (4 Replies)
I have two files and would need to filter out records based on certain criteria, these column are of variable lengths, but the lengths are uniform throughout all the records of the file. I have shown a sample of three records below. Line 1-9 is the item number "0227546_1" in the case of the first... (15 Replies)
I am trying to use awk to update the below tab-delimited file based on 5 different rules/conditions. The final output is also
tab-delimited and each line in the file will meet one of the conditions. My attemp is below as well though I am not very confident in it. Thank you :).
Condition 1: The... (10 Replies)
The below awk will filter a list of 30,000 lines in the tab-delimited file. What I am having trouble with is adding a condition to SVTYPE=CNV
that will only print that line if CI= must be >.05 .
The other condition to add is if SVTYPE=Fusion, then in order to print that line
READ_COUNT must... (3 Replies)
Hi everyone,
I have a file result.txt with records as following and another file mirna.txt with a list of miRNAs e.g. miR22, miR123, miR13 etc.
Gene Transcript miRNA
Gar Nm_111233 miR22
Gar Nm_123440 miR22
Gar Nm_129939 miR22
Hel Nm_233900 miR13
Hel ... (6 Replies)
Hello Friends,
I have a file(InputFile.csv) with the following columns(the columns are pipe-delimited):
ColA|ColB|ColC|ColD|ColE|ColF
Now for this file, I have to get those records which fulfil the following condition:
If "ColB" is NOT NULL and "ColD" has values one of the following... (9 Replies)
1. if the 1st row IDs of input1 (ID1/ID2.....) is equal to any IDNames of input2
print all relevant values together as defined in the output.
2. A bit tricky part is IDno in the output. All we need to do is numbering same kind of
letters as 1 (aa of ID1) and different letters as 2 (ab... (4 Replies)
Hi,
I have a pipe seperated file
I want to write a code to display count of lines that have 20th field not null.
nawk -F"|" '{if ($20!="") print NR,$20}' xyz..txt
This displays records with 20th field also null.
I would like output as: (4 Replies)
Hi,
Am having files with many records, i need to count and display the number of records based on the keyword in one of the column of the records.
for e.g THE FILE CONTAINS TWO RECORDS LIKE.
200903031143150 0 1236060795054357lessrv1 BSNLSERVICE1 BSNLSERVICE1 ... (4 Replies)
I have a flat file and need to count no of records in the file less the header and the trailer record.
I would appreciate any and all asistance
Thanks
Hadi Lalani (2 Replies)