awk script to find data in three file and perform replace operation
Have three files. Any other approach with regards to file concatenation or splitting, etc is appreciated
If column55(billngtype) of file1 contains YMNC or YPBC then pick the value of column13(documentnumber). Now find this documentnumber in column1(Billdoc) of file2 and grep the corresponding value of column6(price) in File2. Now need to find this value taken from column6(price) of File2 in column1(salesdoc) of File3 and need to fetch the corresponding value from column2(Refdoc) against the value from Column1(salesdoc) of FIle3. If value is captured from column2(refdoc) of File3. Put that value in column15(originadocumentnumber) of File1.
For ex-
if File 1,column55(billingtype) has YMNC and column13(documentnumber) values is 420075416 and same is present in column1(Billdoc) of File2 in last row, then fetch the value from column6(price) which is 5049641151 against that column1(billdoc) 420075416. Now find the value taken from column6(price) of FIle2 in FIle3. We can see 5049641151 is present in column1(Salesdoc) in File3. Now fetch the corresponding value from column2(Refdoc) which is 6225972627. Now copy the final value(6225972627) fetched in column15(originaldocumentnumber) against the column13(documentnumber) 420075416
File1
In actual, column billingtype is column55 and column documentnumber is column 13 and column originaldocumentnumber is column 15.
Below is sample only
File2
In actual, column billdoc is column1 only and column price is column 6
File3
Below sample is as it is
Expected Output File1
Code tried so far
Above code is returning source file as it is and is not putting values in column originaldocumentnumber(column 15) in source file(File1)
Hi all,
I would appreciate if anyone knows how to perform adding to date.
As for normal date, i can easily plus with any number.
But when it comes to month end say for example 28 Jun, i need to perform a plus with number 3, it will not return 1 Jul.
Thanks in advance for your help. (4 Replies)
OK I will do my best to explain what I need help with.
I am trying to format an ldif file so I can import it into Oracle oid.
I need the file to look like this example. Keep in mind there are 3000 of these in the file.
changetype: modify
replace: userpassword
dn:... (0 Replies)
Hi All,
I have some data like below.
Step1,Param1,Param2,Param3
1,2,3,4
2,3,4,5
2,4,5,6
3,0,1,2
3,0,0,0
3,2,1,3
........
so on
Where I need to find the median(arithmetic) of each column from Param1...to..Param3 for each set of Step1 values.
(Sort each specific column, if the... (5 Replies)
Hi All,
I need the modification for the below mentioned code (found in one more post https://www.unix.com/shell-programming-scripting/27161-script-generate-average-values.html) to find the average values for all the columns(but for a specific rows) and print the averages side by side.
I have... (4 Replies)
Sorry, about this thread - I solved my own problem! Thanks for taking a look.
edit by bakunin: no problem, but it would have been a nice touch to actually tell us what the solution was. This would have been slightlich more educating than just knowing that you found it.
I changed your title to... (0 Replies)
Hi Gurus,
I did an exhaustive search for finding the script using "sed" to exclude the first line of file during find and replace.
The first line in my file is the header names.
Thanks for your help.. (4 Replies)
I am getting two result: string and int in c++ code. That I want to store into database. The request which generates result is very frequent. So each time performing db operation to store the result is costly for me.
So how this can be achived using dbms_sql? I dont have any experience and how... (1 Reply)
Hi All,
I am using an awk script as below:
awk -F'|' 'BEGIN{OFS="|";} { if ($1==$3 && $3==$7 && $7==$13 && $2==$6 && $6==$11 && $15-$14+1==$11) print $0"|""TRUE"; else print $0"|""FALSE"; }' tempfile.txt
In above script, all conditions are being checked except the one which is... (4 Replies)