I have a file containing ids like this (file1):
These ids are present in muiltiple files named: id1 id1 id3 etc,
To find all occurances of values of file1 in id1,id2 etc, I have used:
Now for each line in file1 (eg, line 1:c9e2c3c6c100000000460000c02000803c63e529c3f5f5f) there should be 2 entries in file idout, like:
for every two lines will be unique, like they a pair.
But there will also be few lines of file1 which will have only a single entry in idout file,like:
Requirement:
a)How to remove (separate out). the single lines? (as depicted above)
b)How to find time lag, like (diff of 2012-06-12 21:00:02,463 and 2012-06-12 21:00:02,606) depiected above for 2 consecutive lines? Need to ensure that the lines must be of same JMS id and message id)
N.B: A loop on file1 can be executed to find occurances in id* files;.Also the time diff (subtraction) can be done in the loop.But that is not feasible due to severe time constraint as the data volume is very high.
regards,
niladri
Moderator's Comments:
please use code tags to allow us to read data and code
---------- Post updated at 08:10 PM ---------- Previous update was at 04:08 PM ----------
Hi Gurus,
Any hints?
thanks,
Niladri
Last edited by jim mcnamara; 06-15-2012 at 08:35 AM..
Hi all,
First of all a big thnx to Jim Mcnamara who personally added code tags throughout my very long initial post.
Secondly, pfb an approach that I have followed to arrive at some part of the solution:
a) Separate out all the jms ids that are occuring more than once (in my file it's twice) from main file, i.e. idout.
b)Now pick up only those lines with these jms ids (from main file, i.e idout):
So , the single line (i.e. one that is out of pair) are left out.
c)Now, to find the time diff between 2 consecutive data lines: For each line in final_entry_exit file:
Convert the min,sec and milli secs data to nearest miilsecs (separate out this data)
Separate out jms id from that line (separate out this data)
As can be observed, lines are coming in pairs. Now I require to subtract 1st column of every even line from 1st column of every odd line to find time diff.
Scenario:
Command used to capture IPs on a host:
/usr/sbin/ifconfig -a | grep "inet" | egrep -v "inet6|0.0.0.0|192.168.100.2" | awk '{print $2}'
Following for loop used to capture interface names:
for INTERFACE in `/usr/sbin/ifconfig -a | nawk '$1 ~ /:$/ && $1 {sub(":$", "", $1); print... (3 Replies)
/usr/sbin/ifconfig -a | grep "inet" | grep -v "inet6" | grep -v "127.0.0.1" |
grep -v "0.0.0.0"|grep -v "192.168.100.2" | awk '{print $2}'
I use above command to get IP addresses on AIX boxes.Values coming here are set to a variable "Host IPs.IP Addresses" in my fingerprinting engine.
... (4 Replies)
Hi,
The following sed command is not working for me, does anyone have a good alternative for joining lines in a file based on a match?
# if a line ends with a backslash, append the next line to it
sed -e :a -e '/\\$/N; s/\\\n//; ta' (6 Replies)
Hi All, thanks in advance for any help you can give me.
I'm trying to get some error checking of a username in my shell script. While I have that part under control, at the moment my script just exits if the username entered doesn't match the correct syntax.
I've been googling to try and... (4 Replies)
Hi there,
i want to direct the out put return from the FOR loop statement to any log file.
code copied below.
for file in `ls *.in`
do
...
...
done
if there is no file then i need to write the log to one file.
Thanks
Arun (3 Replies)
i=1
while
do
mm=02
dd=03
yy=2008
echo "$mm$dd$yy"
i=$(( i+1))
echo "$i"
done
whenever i execute the script above i will get the error below:
syntax error at line 30: `i=$' unexpected (3 Replies)
HELLO all :),
I have been trying to use a simple while loop to read a file " templist", line by line and perform an action. See the code below. The reason for not using a while read line loop is the for the use of the if condition that wouldn't work. I would appreciate some ideas as this has... (2 Replies)
I have a 1-column file with
random numbers. this script runs
to subtract 1 to the number and
written to a file. With over
10,000 lines, it takes >2 minutes
to complete the loop operation.
is there an alternative awk/sed
for looping to reduce the wait?
Thanks!
#!/bin/ksh
for N in `cat... (2 Replies)