May I ask what do you expect from testing against the same condition twice?
Try:
Note that this assumes your log file is consistent with respect to number of dashes.
If not, then you can match, as yoda showed, or you can pre-process, something along the lines:
And then post-process the captured IPs.list to grep for them in the orig file.
I tried your second awk, and it appears that it is assuming the IPs in the log file will always be a specific column. that's accurate. and its my fault for not pointing that out.
the ips can be in any column. so i'm not sure how you'd tweak your awk statement to do that. btw, there was a missing "}" in it, so i changed it to this:
as you can see, i dropped it from 10 to 1, but still, nothing was spat out from the log even though there should have been.
---------- Post updated at 09:07 AM ---------- Previous update was at 09:03 AM ----------
Quote:
Originally Posted by Yoda
You could do something like:
looks like this could work. when i ran your command i got something like this:
the script is suppose to only count IPs that occur at least 10 times in the log file. looks like this is counting all IPs. and i'm not sure where it is applying the threshold of 10. but it looks like this could very well work.
also, notice the blank line. not sure what that means.
Hi,
I have a file that contains 1400 lines similar to the one shown below:
NAME=sara, TOWN=southampton, POSTCODE=SO18777, EMAIL=sara@hotmail.com, PASSWORD=asjdflkjds etc etc (note: this is one line).
Each line has the same fields, but on each line they are in a different order. Eg. the line... (2 Replies)
I have return files from a process that has then original input record followed on the next line by a response record..either AA,........... for accepted or EE,.......... for errored.
i.e
11,new,123
AA,accepted
12,exist,443
EE,rejected
13,old,223
AA,accepted
I want to write a small... (4 Replies)
I would like to pull a column from a file and place it in a variable:
The file would look like this:
N.Korea gibberish garbage
S.Korea gibberish garbage
USA gibberish garbage
Iraq gibberish garbage
Canada gibberish garbage
and items in the first... (8 Replies)
I saw a few posts close to what i want to do, but they didn't look like they would work exactly.. or I need to think out of the box on this.
I have a file that I keep server stats in for my own performance analysis. this file has the output from many commands in it (uptime, vmstats, ps, swap... (2 Replies)
I have AIX 5.1
This may sound like a really dumb question but I have never done this before.
I would like to pull a file off a backup tape and put back on the AIX
is this as simple as as doing a
mount /dev/rmt1
then the file name that is on the tape /dump/rpt/xxxxxx
Do I just copy it... (14 Replies)
Hi all,
I am fairly new to scripting, but I do try and script as much as possible but the more advanced stuff does tend to boggle my mind a bit.
I am at a bit of a loss with this one.
I get entries in my DNS logs, like the below:
I want to extract only the IP address, without the hashes... (5 Replies)
Hi,
I have a requirment where I need to pull different columns from a .csv file.
Here is the sample of the csv file.
account,item,flag1,flag2,flag3,flag4,flag5,......feed,tran
I will be have a config.txt file which will have the following information.
item,flag5,flag10,feed,tran... (2 Replies)
Hello all,
I'm working on a general script for something at work. I'm an up-and-comer backup for a Shell Scripter this company has had for 35 years lol. Anyway, I have a config file I'm trying to pull Variables from as the Config File is used for multiple scripts. Does the below make sense and... (7 Replies)
I'm scanning a list of emails- I need to pull 2 pieces of data, then move to the next file:
Sender's Email Address
Email Date
I need these to be outputted into a single column- separated by a ",". Like this:
Email1's Address, Email1's Date Stamp
Email2's Address, Email2's Date Stamp... (4 Replies)
I am connecting to another server through sftp. I am running one batch script to pull file from another server. sometimes i am receiving partial files. I am using below commands in batch script.
ls -ltr new.txt
mget new.txt
bye
The file is of 1 MB only.In most of the cases , i received... (6 Replies)