awk script (complex)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk script (complex)
# 22  
Old 03-12-2012
The sort command assumes you have an underscore between the text ciscostats and the date eg:

ciscostats_10032012
ciscostats_13032012

I suspect this might not be the case as your ls command just has ciscostats*, what are your actual filenames like?

Pleasse verify that the output of ls ciscostats_* | sort -t_ -k2.5r -k2.3,2.4r -k2.1,2.2r has newest file first and files appear in date order eg:
Code:
ciscostats_13032012
ciscostats_12032012
...
ciscostats_01032012
ciscostats_29022012
ciscostats_28022012


Last edited by Chubler_XL; 03-12-2012 at 11:59 PM..
# 23  
Old 03-13-2012
the ls lists the files perfectly in date order.

I have tried an underscore ciscostats_* with the same result
# 24  
Old 03-13-2012
Well at this stage I'd focus on trying to prove it wrong. If you have a NEW line from the other script etc. that you feel is a genuine NEW record try and grep this in the other log files

For example we know that "NREE_CISCO3750,10,2" is new so it will appear in just 1 logfile eg:

Code:
# grep -l "^NREE_CISCO3750,10,2" ciscostat*
ciscostats_13032012

Try this for other lines you think should be new and see what turns up.
# 25  
Old 03-13-2012
I have, I used grep -l "string" and it confirms which files the string comes from.

If I run my first script..

---------- Post updated at 04:56 AM ---------- Previous update was at 04:39 AM ----------

Chubler appreciate the help mate, but the problem with your code is there is nothing comparing the latest file with the last 3 months worth of files...

Look at post 1 script, it says compare ciscostats_20120312 with *.csv i.e everything then tell me which new lines you have.

Your code does not seem to, it also does not produce >20 line output

Sorry if I have been unclear.
# 26  
Old 03-13-2012
Yes it does, re-read post #20.

The files are sorted into date order and the first file is the most recent so everything is compared to this.
With MATCH set to 20 it will print any lines > 20
With LOOK set as 90 (90 logfiles = 90 days, or approx 3 months).

If you want any more help you should attach your input files to a post (use the paperclip button) if you tar+zip them they wont be so big. We are both looking at the same thing and I can test more before giving up an update.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk in complex number data

Hi, I'm trying to transform my data from the following format: eps:, 0.248281687841641, -2.83539034165844e-7, 2.78042576353472+6.3505226053266e-6i to this: eps:, 0.248281687841641, -2.83539034165844e-7, 2.78042576353472, +6.3505226053266e-6 so I can plot it with GnuPlot. how do I... (4 Replies)
Discussion started by: rogeriogouvea
4 Replies

2. Shell Programming and Scripting

Building a complex xml using awk

Hi I have a complex xml to be build using awk using a lookup file values. Below is the xml <country name="xyz"> <state name="abc"> <city name="qwe" capital="yes"/> <city name="asd" capital="no"/> </state> <state name="qrq"> <city name="rthy" capital="yes"/> <state> </country> ... (1 Reply)
Discussion started by: Nevergivup
1 Replies

3. Shell Programming and Scripting

Complex awk problem

hello, i have a complex awk problem... i have two tables, one with a value (0 to 1) and it's corresponding p-value, like this: 1. table: ______________________________ value p-value ... ... 0.254 0.003 0.245 0.005 0.233 0.006 ... ... ______________________________ and a... (6 Replies)
Discussion started by: dietmar13
6 Replies

4. Shell Programming and Scripting

Complex transpose awk script

Hello to all in forum, Maybe an awk expert could help me with this complex task for me. I have the input shown below and I would like to get the output as follow: - I would like the output separated by commas. - The header is fixed and will be the same always. - For the lines containing... (22 Replies)
Discussion started by: Ophiuchus
22 Replies

5. Shell Programming and Scripting

Help with Complex Awk.

Hi, I have a file. In this file when ever the word "ABC" occurs at position from 25 and 34 I would like to replace the value at postion 100 to 5 for the first 1000 rows only. I have written the following Awk command. nawk 'substr($0,25,9)=="ABC" {print $0}' filename The above command... (4 Replies)
Discussion started by: pinnacle
4 Replies

6. Shell Programming and Scripting

Complex match of numbers between 2 files awk script

Hello to all, I hope some awk guru could help me. I have 2 input files: File1: Is the complete database File2: Contains some numbers which I want to compare File1: "NUMBERKEY","SERVICENAME","PARAMETERNAME","PARAMETERVALUE","ALTERNATENUMBERKEY"... (9 Replies)
Discussion started by: Ophiuchus
9 Replies

7. Shell Programming and Scripting

complex Awk Question

Hi, I have a file look likes this : --->start hir Trace file: pudwh_ora_9998.trc Sort options: fchela exeela ***************************************************************count = number of times OCI procedure was executed cpu = cpu time in seconds executing elapsed = elapsed... (3 Replies)
Discussion started by: yoavbe
3 Replies

8. Shell Programming and Scripting

Sorting complex file with awk

i have a file ddd.txt its delimiter is : but has , and "" within each column as below and also each line ends with ; I_EP,"29":I_US,"120":I_P_ID,"2020":I_NEW,"600":I_OLD,"400":I_POW,"4.5":I_NAME,"TOM";... (9 Replies)
Discussion started by: blackzinga80
9 Replies

9. Shell Programming and Scripting

Complex use with awk

Hi , I have file named docs.txt The content of the file look like this: DOC disk location Size ======= ===== ============= ========= TXT A /dev/dm-1 10 TXT B /dev/dm-2 10 BIN C ... (3 Replies)
Discussion started by: yoavbe
3 Replies

10. Shell Programming and Scripting

Complex Sed/Awk Question?

Hello, So i have this file called /apps/turnout which looks like that of the contents of the /etc/shadow (but not exactly) the file has a long list in it. basically, the contents of this file looks something similar to the following: jajajajalala:D#$#AFVAdfda lalabavisof:#%R@fafla#$... (3 Replies)
Discussion started by: SkySmart
3 Replies
Login or Register to Ask a Question