Awk: Replacement using 2 diff files input and comparison
If $5(date field) in ipfile is less than $7(date field) in deact file & $1 of ipfile is present in deactfile then
$1 to be replaced by $2,$3,$4,$5,$6 of deact file
else if $5(date field) in ipfile is greater than $7(date field) in actfile & $1 of ipfile is present in actfile then
$1 to be replaced by $2,$3,$4,$5,$6 of actfile.
Present Code which only does replacement based on $1 checking and not on $5(date field) of ipfile:
Please help as i am unable to put the date field checks in the code.
Thanks scrutinizer, I will use substr for the date field for the numerical comparison, but getting confused in how to place the required checks in awk(existing code shared), can you suggest the condition for the same in code?
Thanks Akshay. The code did worked with minor modifications. Just need another advice in case there are multiple entries in DEACT file then how to handle such scenario based on the different input. Please refer the updated deact file & updated ipfile.
I have 2 files, I need to use column of file1 and do a comparison on file2 column 1 and print the mismatch is file3 as mentioned below.
Kindly consider that file 1 is having uniq key(column) whereas in file2 we have multiple duplicates (like 44). These duplicates should not come in... (2 Replies)
i am trying to diff two files and the result will be passed to awk and this will get the first 20 characters in every line and put the result in a file.... but i can't generate an output.
$ cat file1.txt
$ cat file2.txt
the line of command is: (2 Replies)
I have 2 files and I want them to be compared in a specific fashion
C_1451_1500 and so on...
1210 1305 1260 1295
1400 1500 1450 1495
Now The script should look for "1200" from A_1200_1250 of... (8 Replies)
I am trying to do the following using awk (is that the best way?):
Read 2 files created from the output of df (say, on different days) and compare the entries using the 1st (FileSys) and 6th (Mount) fields to see if the size has changed. Output (at least), to a new file (some header... (2 Replies)
I have two files which I would like to compare and then manipulate in a way.
pictures.txt 1.1 1.3
dance.txt 1.2 1.4
treehouse.txt 1.3 1.5
pictures.txt 1.5 ref2313 1.4 ref2345 1.3 ref5432 1.2 ref4244
dance.txt 1.6 ref2342 1.5 ref2352 1.4 ref0695 1.3 ref5738 1.2... (1 Reply)
Could you please help me to find the difference between two files. I tried the diff command but did not like the output as it contained < and > signs and the line numbers. Is it possible to do something using awk?
I have two files, say File1.txt contains 5 values and File2.txt... (6 Replies)
I know the topic sounds familiar but I just couldn't adapt or find the right code that solves my particular issue. I really hope you can help.
I would like to compare 2 files in an awk script. Both files have different paths.
The awk script call should look like that awk -f... (7 Replies)
I have two files file1 and file2 delimited by semicolon,
And I want to compare column 2 and column3 of file1 to column3 and column 4 in file2.
abc;cef;155.09;;... (12 Replies)
I have two files with field seperator as "~".
File A: 12~13~14~15
File B: 22~22~32~11
i want to calculate the difference between two files and than calculate the percentage difference and output it to a new file.
How do i do this using awk.
Also please suggest GOOD awk tutorials.
Thank... (7 Replies)