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.
Code:
awk '{arr[$7]++}END{ for(i in arr) {if(arr[i]>1){print i}}}' idout > out
awk -F ':' '{print $3}' out > out_jmsid_mod
b)Now pick up only those lines with these jms ids (from main file, i.e idout):
Code:
fgrep -f out_jmsid_mod idout > final_entry_exit
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.
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)
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=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)
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)
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,
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)
/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)
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)