Look up 2 files and print the concatenated output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Look up 2 files and print the concatenated output
# 15  
Old 03-19-2013
Got Error like this in Unix

nawk: syntax error at source line 1
context is
>>> /^$(TZ=IST+24 <<<
nawk: bailing out at source line 1
# 16  
Old 03-19-2013
Quote:
Originally Posted by aravindj80
Got Error like this in Unix

nawk: syntax error at source line 1
context is
>>> /^$(TZ=IST+24 <<<
nawk: bailing out at source line 1
Why are you using the expression there? Did you read my previous post?

Assign it to a variable and use the variable instead.
# 17  
Old 03-20-2013
Look up failing

Code:
cat f1

Mon Mar 18 00:06:22 2013 bulk WorkOrderIntf::submit wo={ woName="3885582_2" woInfo="test1" soAction=active soName="a23ba23ba23ba41" soAction=active soName="a23ba23ba23ba41" soAction=active soName="a23ba23ba23ba41"
Mon Mar 18 00:06:25 2013 bulk WorkOrderIntf::submit wo={ woName="3885587_2" woInfo="test1" soAction=active soName="a23ba23ba23ba07" soAction=active soName="a23ba23ba23ba07" soAction=active soName="a23ba23ba23ba07"
Mon Mar 18 00:06:34 2013 bulk WorkOrderIntf::submit wo={ woName="3885605_2" woInfo="test1" soAction=active soName="a23ba23ba23ba87" soAction=active soName="a23ba23ba23ba87" soAction=active soName="a23ba23ba23ba87"
Mon Mar 18 00:06:37 2013 bulk WorkOrderIntf::submit wo={ woName="3885604_2" woInfo="test1" soAction=active soName="a23ba23ba23ba32" soAction=active soName="a23ba23ba23ba32" soAction=active soName="a23ba23ba23ba32"
Mon Mar 18 00:16:07 2013 bulk WorkOrderIntf::submit wo={ woName="3885607_2" woInfo="test1" soAction=active soName="a23ba23ba23ba63" soAction=active soName="a23ba23ba23ba63" soAction=active soName="a23ba23ba23ba63"
Mon Mar 18 00:16:10 2013 bulk WorkOrderIntf::submit wo={ woName="3885609_2" woInfo="test1" soAction=active soName="a23ba23ba23ba99" soAction=active soName="a23ba23ba23ba99" soAction=active soName="a23ba23ba23ba99"
Mon Mar 18 00:16:11 2013 bulk WorkOrderIntf::submit wo={ woName="3885610_2" woInfo="test1" soAction=active soName="a23ba23ba23ba79" soAction=active soName="a23ba23ba23ba79" soAction=active soName="a23ba23ba23ba79"

Code:
cat f2

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..
# 18  
Old 03-20-2013
Hi Aravind,

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.
# 19  
Old 03-20-2013
Apologies Mr.Panyam

Code:
nawk 'BEGIN { FS="[=\t\" ]+" } NR==FNR{a[$6]=$9" "$8;next} {if($9 in a) {print $0" "a[$9]}}'  f2 f1

The output is coming as NULL...

Please help as i am struck..
# 20  
Old 03-20-2013
Code:
Pls post the output expected.

# 21  
Old 03-20-2013
Output expected

Mon Mar 18 00:06:22 2013 bulk WorkOrderIntf::submit wo={ woName="3885582_2" woInfo="test1" soAction=active soName="a23ba23ba23ba41" soAction=active soName="a23ba23ba23ba41" soAction=active soName="a23ba23ba23ba41" execute SUCCEEDED

.. ...


...

Mon Mar 18 00:16:11 2013 bulk WorkOrderIntf::submit wo={ woName="3885610_2" woInfo="test1" soAction=active soName="a23ba23ba23ba79" soAction=active soName="a23ba23ba23ba79" soAction=active soName="a23ba23ba23ba79" execute SUCCEEDED
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Compare two files and print output

Hi All, i am trying to compare two files in Centos 6. F1: /tmp/d21 NAME="xvda" TYPE="disk" SIZE="40G" OWNER="root" GROUP="disk" MODE="brw-rw----" MOUNTPOINT="" NAME="xvda1" TYPE="part" SIZE="500M" OWNER="root" GROUP="disk" MODE="brw-rw----" MOUNTPOINT="/boot" NAME="xvda2" TYPE="part"... (2 Replies)
Discussion started by: balu1234
2 Replies

2. Shell Programming and Scripting

Awk: Print Error While Redirecting output in multiple Files

Hi, I have a following code in which I am unable to redirect to multiple files. Can anybody please help with some corrections awk -F, '{ if ( substr($1,26,2)=="02" && substr($1,184,14)=="MTSCC_VALFIRST") { array1++ array2++ array3++ } else if (substr($1,26,2)=="03" &&... (4 Replies)
Discussion started by: siramitsharma
4 Replies

3. Shell Programming and Scripting

Match two columns from two files and print output

Hello, I have two files which are of the following format File 1 which has two columns Protein_ID Substitution NP_997239 T53R NP_060668 V267M NP_058515 P856A NP_001206 T55M NP_006601 D371Y ... (2 Replies)
Discussion started by: nans
2 Replies

4. Shell Programming and Scripting

Comparing 2 xml files and print the differences only in output

Hi....I'm having 2 xml files, one is having some special characters and another is a clean xml file does not have any special characters. Now I need one audit kind of file which will show me only from which line the special characters have been removed and the special characters. Can you please... (1 Reply)
Discussion started by: Krishanu Saha
1 Replies

5. Shell Programming and Scripting

Print only lines where fields concatenated match strings

Hello everyone, Maybe somebody could help me with an awk script. I have this input (field separator is comma ","): 547894982,M|N|J,U|Q|P,98,101,0,1,1 234900027,M|N|J,U|Q|P,98,101,0,1,1 234900023,M|N|J,U|Q|P,98,54,3,1,1 234900028,M|H|J,S|Q|P,98,101,0,1,1 234900030,M|N|J,U|F|P,98,101,0,1,1... (2 Replies)
Discussion started by: Ophiuchus
2 Replies

6. Shell Programming and Scripting

match two key columns in two files and print output (awk)

I have two files... file1 and file2. Where columns 1 and 2 of file1 match columns 1 and 2 of file2 I want to create a new file that is all file1 + columns 3 and 4 of file2 :b: Many thanks if you know how to do this.... :b: file1 31-101 106 0 92 31-101 106 29 ... (2 Replies)
Discussion started by: pelhabuan
2 Replies

7. UNIX for Dummies Questions & Answers

Getting non unique lines from concatenated files

Hi All, Is there a way to get NON unique lines from 2 or more concatenated files? Basically I have several files which are very similar with the exception of few lines and I want to find out which lines are different in each file. Very simple example is file1 contains: 1 2 3 4 5file2... (122 Replies)
Discussion started by: pawannoel
122 Replies

8. Shell Programming and Scripting

compare two files and search keyword and print output

You have two files to compare by searching keyword from one file into another file File A 23 >pp_ANSWER 24 >aa hello 25 >jau head wear 66 >jss oops 872 >aqq olps ploww oww sss 722 >GG_KILLER ..... large files File B Beta done KILLER John Mayor calix meyers ... (5 Replies)
Discussion started by: cdfd123
5 Replies

9. Shell Programming and Scripting

compare columns from seven files and print the output

Hi guys, I need some help to come out with a solution . I have seven such files but I am showing only three for convenience. filea a5 20 a8 16 fileb a3 42 a7 14 filec a5 23 a3 07 The output file shoud contain the data in table form showing first field of... (7 Replies)
Discussion started by: smriti_shridhar
7 Replies

10. Shell Programming and Scripting

awk to compare lines of two files and print output on screen

hey guys, I have two files both with two columns, I have already created an awk code to ignore certain lines (e.g lines that start with 963) as they wou ld begin with a certain string, however, the rest I have added together and calculated the average. At the moment the code also displays... (3 Replies)
Discussion started by: chlfc
3 Replies
Login or Register to Ask a Question