09-23-2009
getting wrong output with AWK command!!!
i have a file which gets appended with 9 records daily and the file keeps growing from then...i use to store the previous day files count in a variable called oldfilecount and current files count as newfilecount.my requirement is that i need to start processing only the new records from the file....i mean only if newffilecount > oldfilecount and only fetch the current days 9 records and process it...the no of records which is 9 as of now might vary later..so i just need to fetch the records which has come for today neglecting all the previous days records and process the current records alone...
i tried
awk 'NR>$oldfilecount {print $0}' $eachfile | sed 's/"//g' > outfile
but i m getting all the records displayed...even the old records :-(
but when i give
awk 'NR>64 {print $0}' $eachfile | sed 's/"//g' > outfile i get only the current days records...
How do i get my job done...since the oldfilecount variable keeps changing and based on that i need to filter out the old records and fetch only the new records and process it...
Thanks in advance!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
I have a problem with qwk command.
i have to check process status and for that i am using command
prstat -mvL 1 1
and it gives me the entire output
but when i use this command with awk like this:
prstat -mvL 1 1 | awk -F" " '{print $1,$15}'
to get first and 15th arguments.
... (3 Replies)
Discussion started by: usha rao
3 Replies
2. Shell Programming and Scripting
Hi all,
I have a problem with sort command.
i have a file which looks like this:
"file1
1073 java/4
1073 java/180
1073 java/170
1073 java/176
1073 java/167
1073 java/40
1073 java/33
1073 java/136
28988 java/76
28988 java/73
28988 java/48
28988 java/26"
and i want to sort... (8 Replies)
Discussion started by: usha rao
8 Replies
3. Shell Programming and Scripting
Hi All,
i have a file which have many fields delimited by ,(comma)
now i have to show only few fields and not all.
the sample text file looks like this:
TYPE=SERVICEEVENT, TIMESTAMP=05/06/2009 11:01:40 PM, HOST=sppwa634, APPLICATION=ASComp, FUNCTION=LimitsService, SOU... (8 Replies)
Discussion started by: usha rao
8 Replies
4. Shell Programming and Scripting
Hi guys -
I am trying a small script to tell me if there is a file that exists less than 1k. It should report ERROR, otherwise the check is good.
I wrote this script down, however it never runs in the if/then statement. It always returns the echo ERROR.
MYSIZE=$(find /home/student/dir1... (8 Replies)
Discussion started by: DallasT
8 Replies
5. Shell Programming and Scripting
Hi All
I am trying to run a script in linux wherein i have a command like this
grep ^prmAttunityUser= djpHewr2XFMAttunitySetup_ae1_tmp
djpHewr2XFMAttunitySetup_ae1_tmp is a temporary file in which the user value is stored but this command in the script returns me balnk value whereas it has a... (4 Replies)
Discussion started by: vee_789
4 Replies
6. Shell Programming and Scripting
hi Friends ,
I have a file as below
s.txt
1~2~~4
2~6~~7
3~8~~9
t.txt
1~2~~4
2~5~8~7
3~8~~7
header for both files is common (2 Replies)
Discussion started by: i150371485
2 Replies
7. Shell Programming and Scripting
Hi All,
I am trying to run a script which will search for 2 strings(stopped,started) in a text file and echo an output depending on below condition
-bash-3.2$ cat trial1.txt
v
ggg
f
-bash-3.2$ cat trial1.sh
VAR9=` grep 'stopped' /tmp/trial1.txt`
VAR10=` grep 'started'... (4 Replies)
Discussion started by: srkmish
4 Replies
8. Solaris
Hi all,
In my SunOS 5.10, the command awk using BEGIN option doesn't print output variables like expected
here is my test:
with the following code everything is alright
ps -eo pcpu,args | grep "httpd" | awk ' { print $1 } '
the result is
0.1
However, with this command
ps -eo... (3 Replies)
Discussion started by: Elmassimo
3 Replies
9. Shell Programming and Scripting
The awk below is close but I can't seem to fix it to produce the desired output. Thank you :).
current awk with output
awk '{c1++; c2+=($2)}
END{for (e in c1) print e, c1, c2}' input
EFCAB5 2 50
USH2A 2 19
desired... (8 Replies)
Discussion started by: cmccabe
8 Replies
10. Shell Programming and Scripting
The below code usually works when the value for the COLUMN variable is numerical. but im in a situation where the number of fields in a file is not definitive. it changes.
but what is static is that the value i want to retrieve from the log is 3 fields from the last field. which is what i... (9 Replies)
Discussion started by: SkySmart
9 Replies
LEARN ABOUT DEBIAN
ldns-compare-zones
ldns-compare-zones(1) General Commands Manual ldns-compare-zones(1)
NAME
ldns-compare-zones - read and compare two zonefiles and print differences
SYNOPSIS
ldns-compare-zones [-c] [-i] [-d] [-z] [-s] ZONEFILE1 ZONEFILE2
DESCRIPTION
ldns-compare-zones reads two DNS zone files and prints number of differences.
Output is formated to:
+NUM_INS -NUM_DEL ~NUM_CHG
The major comparison is based on the owner name. If an owner name is present in zonefile 1, but not in zonefile 2, the resource records
with this owner name are considered deleted, and counted as NUM_DEL. If an owner name is present in zonefile 2, but not in zonefile 1, the
resource records with this owner name are considered inserted, and counted as NUM_INS. If an owner name is present in both, but there is a
difference in the amount or content of the records, these are considered changed, and counted as NUM_CHG.
OPTIONS
-c Print resource records whose owner names are in both zone files, but with different resource records. (a.k.a. changed)
-i Print resource records whose owner names are present only in ZONEFILE2 (a.k.a. inserted)
-d Print resource records whose owner names are present only in ZONEFILE1 (a.k.a. deleted)
-a Print all changes. Specifying this option is the same as specifying -c -i amd -d.
-z Suppress zone sorting; this option is not recommended; it can cause records to be incorrectly marked as changed, depending of the
nature of the changes.
-s Do not exclude the SOA record from the comparison. The SOA record may then show up as changed due to a new serial number. Off by
default since you may be interested to know if (other zone apex elements) have changed.
-h Show usage and exit
-v Show the version and exit
AUTHOR
Written by Ondej Sury <ondrej@sury.org> for CZ.NIC, z.s.p.o. (czech domain registry)
REPORTING BUGS
Report bugs to <ondrej@sury.org>.
COPYRIGHT
Copyright (C) 2005 CZ.NIC, z.s.p.o.. This is free software. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
17 Oct 2007 ldns-compare-zones(1)