Sun Mar 17 00:01:33 2013 submit , Name="1234"
Sun Mar 17 00:01:33 2013 submit , Name="1344"
Sun Mar 17 00:01:33 2013 submit , Name="1124"
..
..
..
..
Sun Mar 17 00:01:33 2013 submit , Name="8901"
file 2
Sun Mar 17 00:02:47 2013 1234 execute SUCCEEDED
Sun Mar 17 00:02:48 2013 1344 execute FAILED
Sun Mar 17 00:02:48 2013 1124 execute SUCCEEDED
Sun Mar 17 00:02:49 2013 1222 execute SUCCEEDED
Sun Mar 17 00:02:49 2013 1111 execute SUCCEEDED
Sun Mar 17 00:02:50 2013 1211 execute SUCCEEDED
Sun Mar 17 00:02:50 2013 1111 execute SUCCEEDED
Sun Mar 17 00:02:51 2013 8901 execute FAILED
both the file should be looked up and the out put should be
Sun Mar 17 00:01:33 2013 submit , Name="1234" execute SUCCEEDED
Sun Mar 17 00:01:33 2013 submit , Name="1344" execute FAILED
..
..
..
Not sure, but your solution did not work for me. The below one is working ok for me.
$ cat f1
Sun Mar 17 00:01:33 2013 submit , Name="1234"
Sun Mar 17 00:01:33 2013 submit , Name="1344"
Sun Mar 17 00:01:33 2013 submit , Name="1124"
$ cat f2
Sun Mar 17 00:02:47 2013 1234 execute SUCCEEDED
Sun Mar 17 00:02:48 2013 1344 execute FAILED
Sun Mar 17 00:02:48 2013 1124 execute SUCCEEDED
Sun Mar 17 00:02:49 2013 1222 execute SUCCEEDED
Sun Mar 17 00:02:49 2013 1111 execute SUCCEEDED
Sun Mar 17 00:02:50 2013 1211 execute SUCCEEDED
Sun Mar 17 00:02:50 2013 1111 execute SUCCEEDED
Sun Mar 17 00:02:51 2013 8901 execute FAILED
$ awk 'BEGIN { FS="[=\t\" ]+" } NR==FNR{a[$6]=$7" "$8;next} {if($9 in a) {print $0" "a[$9]}}' f2 f1
Sun Mar 17 00:01:33 2013 submit , Name="1234" execute SUCCEEDED
Sun Mar 17 00:01:33 2013 submit , Name="1344" execute FAILED
Sun Mar 17 00:01:33 2013 submit , Name="1124" execute SUCCEEDED
Your requirement is keep changing. Pls post , sample input and the output you are expecting from it ( mention the condition too ) . Use code tags to place your data.
$ cat f1
Sun Mar 17 00:01:33 2013
submit ,Name="1234"
Hello 123
how are you
Sun Mar 17 00:01:33 2013
submit , Name="1344"
Hello 345
how are you
Sun Mar 17 00:01:33 2013
submit , Name="1124"
Hello 456
how are you
nawk '/^`TZ=IST+24 Date + %a`/ && p{print p;p=""}{p=p $0}END{if(p) print p}' f1 > f3.txt
I executed the above script to join all the lines based on the Day . I am not able to give input as `TZ=IST+24 Date + %a` in this and if i give all the lines get concatenated and the whole file becomes 1 line.
But if i manually give expression as /^Sun/ it is working perfectly , but the same is not working if i try with `TZ=IST+24 Date + %a` as input.
Mon Mar 18 00:06:24 2013 3885582_2 execute SUCCEEDED
Mon Mar 18 00:06:25 2013 3885587_2 execute SUCCEEDED
Mon Mar 18 00:06:34 2013 3885605_2 execute SUCCEEDED
Mon Mar 18 00:06:38 2013 3885604_2 execute SUCCEEDED
Mon Mar 18 00:16:10 2013 3885607_2 execute SUCCEEDED
Mon Mar 18 00:16:11 2013 3885609_2 execute SUCCEEDED
Mon Mar 18 00:16:11 2013 3885610_2 execute SUCCEEDED
Mon Mar 18 00:16:13 2013 3885608_2 execute SUCCEEDED
Mon Mar 18 00:16:14 2013 3885613_2 execute SUCCEEDED
Mon Mar 18 00:16:15 2013 3885618_2 execute SUCCEEDED
Mon Mar 18 00:16:15 2013 3885615_2 execute SUCCEEDED
Mon Mar 18 00:16:19 2013 3885623_2 execute SUCCEEDED
Mon Mar 18 00:16:20 2013 3885624_2 execute SUCCEEDED
Mon Mar 18 00:16:24 2013 3885626_2 execute SUCCEEDED
Mon Mar 18 00:25:00 2013 3885634_2 execute SUCCEEDED
Mon Mar 18 00:25:00 2013 3885628_2 execute SUCCEEDED
Mon Mar 18 00:25:01 2013 3885635_2 execute SUCCEEDED
Mon Mar 18 00:40:15 2013 3885641_2 execute SUCCEEDED
Still look up is failing from f2 and f1.. from f2 i need the value need to be picked up example "3885582_2" and look in the file f1 and append the status to file3.
the field from f2 has to go for complete look up in the f1 and then only it should be go to the next line and pick up the same field..
Every time you are hijacking your own post. Each time your are posting different questions and expecting different output. In your last post, you posted some random files, neither you mentioned output expected not what you have tried so far.