awk - replace number in file from numbers in another file












-3















Is it possible to replace numbers in a file with number from another one in awk?
I would like to replace these numbers from one file



$2 ~ /<0|2|3>/ && $3 ~ /<2|4|5>/ { REPLACE } 


with number in another file



$2 ~ /<0|2|3>/ && $3 ~ /<2|4|5>/ 


The conditions where to find the numbers are same in both files.



I mean the rows that included 0 in second column and number 2,4 and 5 in the third, rows included 2 in second column and numbers 2,4 and 5 in the third and so on.



And file I want to replace numbers in the rows that included 0 in second column and number 2,4 and 5 in the third, rows included 2 in second column and numbers 2,4 and 5 in the third and so on, in this file 1:



 1 0 1 0 0 1 0 2 70 1                    
o 0 1 0 1 1 5.732821 0.46744E-05
o 0 2 1 1 1 54002.833296879 0.7
o 0 3 0 1 1 0.0883 -0.010
o 0 4 1 1 1 150.503940056 2.5
o 0 5 1 1 1 108.416980920 0.5
o 0 6 0 1 1 0.38 -0.04
o 0 7 0 1 1 0.00422 0.000057
o 2 1 0 1 1 73413.0 0.0001
o 2 2 1 1 1 36139.145034869 105.0
o 2 3 0 1 1 0.56 0.01
o 2 4 1 1 1 231.368723333 10.0
o 2 5 1 1 1 7.081186962 2.0
o 2 6 0 1 1 0.48 0.25
o 3 1 0 1 1 365.256360000 0.1
o 3 2 1 1 1 51548.049995536 10.0
o 3 3 0 1 1 0.016710220 0.001
o 3 4 1 1 1 295.088636004 10.0
o 3 5 1 1 1 0.001035479 0.0001


with numbes from file 2:



o 0  1 0 1 1      5.732821000     0.000 
o 0 2 0 1 1 54002.835589759 0.000
o 0 3 0 1 1 0.088300000 -0.010
o 0 4 0 1 1 150.639327248 0.002
o 0 5 0 1 1 108.385358471 0.001
o 0 6 0 1 1 0.380000000 -0.040
o 0 7 0 1 1 0.004220000 0.000
o 0 8 0 1 1 0.000000000 0.100
o 0 9 0 1 1 0.000000000 0.100
o 0 10 0 1 1 0.000000000 0.100
o 0 11 0 1 1 0.000000000 0.100

o 2 1 0 1 1 73413.000000000 0.000
o 2 2 0 1 1 36144.833043045 0.069
o 2 3 0 1 1 0.560000000 0.010
o 2 4 0 1 1 232.342353773 0.020
o 2 5 0 1 1 7.062319637 0.000
o 2 6 0 1 1 0.480000000 0.250
o 2 7 0 1 1 0.000000000 5.730
o 2 8 0 1 1 0.000000000 0.100
o 2 9 0 1 1 0.000000000 0.100
o 2 10 0 1 1 0.000000000 0.100
o 2 11 0 1 1 0.000000000 0.100

o 3 1 0 1 1 365.256360000 0.100
o 3 2 0 1 1 51548.116292363 0.006
o 3 3 0 1 1 0.016710220 0.001
o 3 4 0 1 1 295.418908132 0.005
o 3 5 0 1 1 0.001042508 0.000
o 3 6 0 1 1 0.000036626 0.000
o 3 7 0 1 1 0.000009111 0.000
o 3 8 0 1 1 0.000000000 0.100
o 3 9 0 1 1 0.000000000 0.100
o 3 10 0 1 1 0.000000000 0.100
o 3 11 0 1 1 0.000000000 0.100


and get file 3:



o 0 1 0 1 1  5.732821           0.46744E-05 
o 0 2 1 1 1 54002.835589759 0.7
o 0 3 0 1 1 0.0883 -0.010
o 0 4 1 1 1 150.639327248 2.1
o 0 5 1 1 1 108.385358471 0.5
o 0 6 0 1 1 0.38 -0.04
o 0 7 0 1 1 0.00422 0.000057
o 2 1 0 1 1 73413.0 0.0001
o 2 2 1 1 1 36144.833043045 105.0
o 2 3 0 1 1 0.56 0.01
o 2 4 1 1 1 232.342353773 10.0
o 2 5 1 1 1 7.062319637 2.0
o 2 6 0 1 1 0.48 0.25
o 3 1 0 1 1 365.256360000 0.1
o 3 2 1 1 1 51548.116292363 10.0
o 3 3 0 1 1 0.016710220 0.001
o 3 4 1 1 1 295.418908132 10.0
o 3 5 1 1 1 0.001042508 0.0001
o 3 6 0 1 1 0.000036626 0.000001
o 3 7 0 1 1 0.000009111 0.00000001


enter image description here



I care about this numbers that are indentified by the number in second and third column in all three files. So I want to replace these numbers in file 1 with numbers in file 2 and the result is file 3.



MINIMALISTIC PROBLEM



I have a file A



o 0 1 0 1 1  40          
o 0 2 1 1 1 50


And I want to replace number in row, where is in the second column number 0 and in the 3rd column number 2. So I want to replace number 50. I would like to replace number 50 with number, that is in the another file B:



o 0 1 0 1 1  48          
o 0 2 1 1 1 55


This number is in row, where is in the second column number 0 and in the 3rd column number 2 too. So it should be replaced by 55. I expect the output



o 0 1 0 1 1  40          
o 0 2 1 1 1 55









share|improve this question




















  • 3





    ?? Please explain what you are trying to do rather than post code that doesn't do what you want. Are you trying to replace occurrences of 0,2 and 3 in column 2 with 2,4 and 5? Or are you trying to replace 2,4 and 5 in column 3 with values from column 3 of the other file? Or are your replacement values in column 8? Provide a clearer description and sample input along with the desired output.

    – William Pursell
    Dec 30 '18 at 11:41











  • I editted the question

    – Elisabeth
    Dec 30 '18 at 12:12











  • Hmmm, still not clear I think. I guess you should should show Input1, Input2 and Outpur clearly marked, so that we can better understand the logic behind your question.

    – vaettchen
    Dec 30 '18 at 13:59











  • Is it fine now?

    – Elisabeth
    Dec 30 '18 at 14:25











  • You are matching <0 or 2 or 3>; if you intend for the anchors to govern all these numbers, you want <(0|2|3)> (which can be simplified to <[023]> as long as all the numbers are a single digit). But this is just a detail; I still have no idea what you want.

    – tripleee
    Dec 30 '18 at 14:44
















-3















Is it possible to replace numbers in a file with number from another one in awk?
I would like to replace these numbers from one file



$2 ~ /<0|2|3>/ && $3 ~ /<2|4|5>/ { REPLACE } 


with number in another file



$2 ~ /<0|2|3>/ && $3 ~ /<2|4|5>/ 


The conditions where to find the numbers are same in both files.



I mean the rows that included 0 in second column and number 2,4 and 5 in the third, rows included 2 in second column and numbers 2,4 and 5 in the third and so on.



And file I want to replace numbers in the rows that included 0 in second column and number 2,4 and 5 in the third, rows included 2 in second column and numbers 2,4 and 5 in the third and so on, in this file 1:



 1 0 1 0 0 1 0 2 70 1                    
o 0 1 0 1 1 5.732821 0.46744E-05
o 0 2 1 1 1 54002.833296879 0.7
o 0 3 0 1 1 0.0883 -0.010
o 0 4 1 1 1 150.503940056 2.5
o 0 5 1 1 1 108.416980920 0.5
o 0 6 0 1 1 0.38 -0.04
o 0 7 0 1 1 0.00422 0.000057
o 2 1 0 1 1 73413.0 0.0001
o 2 2 1 1 1 36139.145034869 105.0
o 2 3 0 1 1 0.56 0.01
o 2 4 1 1 1 231.368723333 10.0
o 2 5 1 1 1 7.081186962 2.0
o 2 6 0 1 1 0.48 0.25
o 3 1 0 1 1 365.256360000 0.1
o 3 2 1 1 1 51548.049995536 10.0
o 3 3 0 1 1 0.016710220 0.001
o 3 4 1 1 1 295.088636004 10.0
o 3 5 1 1 1 0.001035479 0.0001


with numbes from file 2:



o 0  1 0 1 1      5.732821000     0.000 
o 0 2 0 1 1 54002.835589759 0.000
o 0 3 0 1 1 0.088300000 -0.010
o 0 4 0 1 1 150.639327248 0.002
o 0 5 0 1 1 108.385358471 0.001
o 0 6 0 1 1 0.380000000 -0.040
o 0 7 0 1 1 0.004220000 0.000
o 0 8 0 1 1 0.000000000 0.100
o 0 9 0 1 1 0.000000000 0.100
o 0 10 0 1 1 0.000000000 0.100
o 0 11 0 1 1 0.000000000 0.100

o 2 1 0 1 1 73413.000000000 0.000
o 2 2 0 1 1 36144.833043045 0.069
o 2 3 0 1 1 0.560000000 0.010
o 2 4 0 1 1 232.342353773 0.020
o 2 5 0 1 1 7.062319637 0.000
o 2 6 0 1 1 0.480000000 0.250
o 2 7 0 1 1 0.000000000 5.730
o 2 8 0 1 1 0.000000000 0.100
o 2 9 0 1 1 0.000000000 0.100
o 2 10 0 1 1 0.000000000 0.100
o 2 11 0 1 1 0.000000000 0.100

o 3 1 0 1 1 365.256360000 0.100
o 3 2 0 1 1 51548.116292363 0.006
o 3 3 0 1 1 0.016710220 0.001
o 3 4 0 1 1 295.418908132 0.005
o 3 5 0 1 1 0.001042508 0.000
o 3 6 0 1 1 0.000036626 0.000
o 3 7 0 1 1 0.000009111 0.000
o 3 8 0 1 1 0.000000000 0.100
o 3 9 0 1 1 0.000000000 0.100
o 3 10 0 1 1 0.000000000 0.100
o 3 11 0 1 1 0.000000000 0.100


and get file 3:



o 0 1 0 1 1  5.732821           0.46744E-05 
o 0 2 1 1 1 54002.835589759 0.7
o 0 3 0 1 1 0.0883 -0.010
o 0 4 1 1 1 150.639327248 2.1
o 0 5 1 1 1 108.385358471 0.5
o 0 6 0 1 1 0.38 -0.04
o 0 7 0 1 1 0.00422 0.000057
o 2 1 0 1 1 73413.0 0.0001
o 2 2 1 1 1 36144.833043045 105.0
o 2 3 0 1 1 0.56 0.01
o 2 4 1 1 1 232.342353773 10.0
o 2 5 1 1 1 7.062319637 2.0
o 2 6 0 1 1 0.48 0.25
o 3 1 0 1 1 365.256360000 0.1
o 3 2 1 1 1 51548.116292363 10.0
o 3 3 0 1 1 0.016710220 0.001
o 3 4 1 1 1 295.418908132 10.0
o 3 5 1 1 1 0.001042508 0.0001
o 3 6 0 1 1 0.000036626 0.000001
o 3 7 0 1 1 0.000009111 0.00000001


enter image description here



I care about this numbers that are indentified by the number in second and third column in all three files. So I want to replace these numbers in file 1 with numbers in file 2 and the result is file 3.



MINIMALISTIC PROBLEM



I have a file A



o 0 1 0 1 1  40          
o 0 2 1 1 1 50


And I want to replace number in row, where is in the second column number 0 and in the 3rd column number 2. So I want to replace number 50. I would like to replace number 50 with number, that is in the another file B:



o 0 1 0 1 1  48          
o 0 2 1 1 1 55


This number is in row, where is in the second column number 0 and in the 3rd column number 2 too. So it should be replaced by 55. I expect the output



o 0 1 0 1 1  40          
o 0 2 1 1 1 55









share|improve this question




















  • 3





    ?? Please explain what you are trying to do rather than post code that doesn't do what you want. Are you trying to replace occurrences of 0,2 and 3 in column 2 with 2,4 and 5? Or are you trying to replace 2,4 and 5 in column 3 with values from column 3 of the other file? Or are your replacement values in column 8? Provide a clearer description and sample input along with the desired output.

    – William Pursell
    Dec 30 '18 at 11:41











  • I editted the question

    – Elisabeth
    Dec 30 '18 at 12:12











  • Hmmm, still not clear I think. I guess you should should show Input1, Input2 and Outpur clearly marked, so that we can better understand the logic behind your question.

    – vaettchen
    Dec 30 '18 at 13:59











  • Is it fine now?

    – Elisabeth
    Dec 30 '18 at 14:25











  • You are matching <0 or 2 or 3>; if you intend for the anchors to govern all these numbers, you want <(0|2|3)> (which can be simplified to <[023]> as long as all the numbers are a single digit). But this is just a detail; I still have no idea what you want.

    – tripleee
    Dec 30 '18 at 14:44














-3












-3








-3


0






Is it possible to replace numbers in a file with number from another one in awk?
I would like to replace these numbers from one file



$2 ~ /<0|2|3>/ && $3 ~ /<2|4|5>/ { REPLACE } 


with number in another file



$2 ~ /<0|2|3>/ && $3 ~ /<2|4|5>/ 


The conditions where to find the numbers are same in both files.



I mean the rows that included 0 in second column and number 2,4 and 5 in the third, rows included 2 in second column and numbers 2,4 and 5 in the third and so on.



And file I want to replace numbers in the rows that included 0 in second column and number 2,4 and 5 in the third, rows included 2 in second column and numbers 2,4 and 5 in the third and so on, in this file 1:



 1 0 1 0 0 1 0 2 70 1                    
o 0 1 0 1 1 5.732821 0.46744E-05
o 0 2 1 1 1 54002.833296879 0.7
o 0 3 0 1 1 0.0883 -0.010
o 0 4 1 1 1 150.503940056 2.5
o 0 5 1 1 1 108.416980920 0.5
o 0 6 0 1 1 0.38 -0.04
o 0 7 0 1 1 0.00422 0.000057
o 2 1 0 1 1 73413.0 0.0001
o 2 2 1 1 1 36139.145034869 105.0
o 2 3 0 1 1 0.56 0.01
o 2 4 1 1 1 231.368723333 10.0
o 2 5 1 1 1 7.081186962 2.0
o 2 6 0 1 1 0.48 0.25
o 3 1 0 1 1 365.256360000 0.1
o 3 2 1 1 1 51548.049995536 10.0
o 3 3 0 1 1 0.016710220 0.001
o 3 4 1 1 1 295.088636004 10.0
o 3 5 1 1 1 0.001035479 0.0001


with numbes from file 2:



o 0  1 0 1 1      5.732821000     0.000 
o 0 2 0 1 1 54002.835589759 0.000
o 0 3 0 1 1 0.088300000 -0.010
o 0 4 0 1 1 150.639327248 0.002
o 0 5 0 1 1 108.385358471 0.001
o 0 6 0 1 1 0.380000000 -0.040
o 0 7 0 1 1 0.004220000 0.000
o 0 8 0 1 1 0.000000000 0.100
o 0 9 0 1 1 0.000000000 0.100
o 0 10 0 1 1 0.000000000 0.100
o 0 11 0 1 1 0.000000000 0.100

o 2 1 0 1 1 73413.000000000 0.000
o 2 2 0 1 1 36144.833043045 0.069
o 2 3 0 1 1 0.560000000 0.010
o 2 4 0 1 1 232.342353773 0.020
o 2 5 0 1 1 7.062319637 0.000
o 2 6 0 1 1 0.480000000 0.250
o 2 7 0 1 1 0.000000000 5.730
o 2 8 0 1 1 0.000000000 0.100
o 2 9 0 1 1 0.000000000 0.100
o 2 10 0 1 1 0.000000000 0.100
o 2 11 0 1 1 0.000000000 0.100

o 3 1 0 1 1 365.256360000 0.100
o 3 2 0 1 1 51548.116292363 0.006
o 3 3 0 1 1 0.016710220 0.001
o 3 4 0 1 1 295.418908132 0.005
o 3 5 0 1 1 0.001042508 0.000
o 3 6 0 1 1 0.000036626 0.000
o 3 7 0 1 1 0.000009111 0.000
o 3 8 0 1 1 0.000000000 0.100
o 3 9 0 1 1 0.000000000 0.100
o 3 10 0 1 1 0.000000000 0.100
o 3 11 0 1 1 0.000000000 0.100


and get file 3:



o 0 1 0 1 1  5.732821           0.46744E-05 
o 0 2 1 1 1 54002.835589759 0.7
o 0 3 0 1 1 0.0883 -0.010
o 0 4 1 1 1 150.639327248 2.1
o 0 5 1 1 1 108.385358471 0.5
o 0 6 0 1 1 0.38 -0.04
o 0 7 0 1 1 0.00422 0.000057
o 2 1 0 1 1 73413.0 0.0001
o 2 2 1 1 1 36144.833043045 105.0
o 2 3 0 1 1 0.56 0.01
o 2 4 1 1 1 232.342353773 10.0
o 2 5 1 1 1 7.062319637 2.0
o 2 6 0 1 1 0.48 0.25
o 3 1 0 1 1 365.256360000 0.1
o 3 2 1 1 1 51548.116292363 10.0
o 3 3 0 1 1 0.016710220 0.001
o 3 4 1 1 1 295.418908132 10.0
o 3 5 1 1 1 0.001042508 0.0001
o 3 6 0 1 1 0.000036626 0.000001
o 3 7 0 1 1 0.000009111 0.00000001


enter image description here



I care about this numbers that are indentified by the number in second and third column in all three files. So I want to replace these numbers in file 1 with numbers in file 2 and the result is file 3.



MINIMALISTIC PROBLEM



I have a file A



o 0 1 0 1 1  40          
o 0 2 1 1 1 50


And I want to replace number in row, where is in the second column number 0 and in the 3rd column number 2. So I want to replace number 50. I would like to replace number 50 with number, that is in the another file B:



o 0 1 0 1 1  48          
o 0 2 1 1 1 55


This number is in row, where is in the second column number 0 and in the 3rd column number 2 too. So it should be replaced by 55. I expect the output



o 0 1 0 1 1  40          
o 0 2 1 1 1 55









share|improve this question
















Is it possible to replace numbers in a file with number from another one in awk?
I would like to replace these numbers from one file



$2 ~ /<0|2|3>/ && $3 ~ /<2|4|5>/ { REPLACE } 


with number in another file



$2 ~ /<0|2|3>/ && $3 ~ /<2|4|5>/ 


The conditions where to find the numbers are same in both files.



I mean the rows that included 0 in second column and number 2,4 and 5 in the third, rows included 2 in second column and numbers 2,4 and 5 in the third and so on.



And file I want to replace numbers in the rows that included 0 in second column and number 2,4 and 5 in the third, rows included 2 in second column and numbers 2,4 and 5 in the third and so on, in this file 1:



 1 0 1 0 0 1 0 2 70 1                    
o 0 1 0 1 1 5.732821 0.46744E-05
o 0 2 1 1 1 54002.833296879 0.7
o 0 3 0 1 1 0.0883 -0.010
o 0 4 1 1 1 150.503940056 2.5
o 0 5 1 1 1 108.416980920 0.5
o 0 6 0 1 1 0.38 -0.04
o 0 7 0 1 1 0.00422 0.000057
o 2 1 0 1 1 73413.0 0.0001
o 2 2 1 1 1 36139.145034869 105.0
o 2 3 0 1 1 0.56 0.01
o 2 4 1 1 1 231.368723333 10.0
o 2 5 1 1 1 7.081186962 2.0
o 2 6 0 1 1 0.48 0.25
o 3 1 0 1 1 365.256360000 0.1
o 3 2 1 1 1 51548.049995536 10.0
o 3 3 0 1 1 0.016710220 0.001
o 3 4 1 1 1 295.088636004 10.0
o 3 5 1 1 1 0.001035479 0.0001


with numbes from file 2:



o 0  1 0 1 1      5.732821000     0.000 
o 0 2 0 1 1 54002.835589759 0.000
o 0 3 0 1 1 0.088300000 -0.010
o 0 4 0 1 1 150.639327248 0.002
o 0 5 0 1 1 108.385358471 0.001
o 0 6 0 1 1 0.380000000 -0.040
o 0 7 0 1 1 0.004220000 0.000
o 0 8 0 1 1 0.000000000 0.100
o 0 9 0 1 1 0.000000000 0.100
o 0 10 0 1 1 0.000000000 0.100
o 0 11 0 1 1 0.000000000 0.100

o 2 1 0 1 1 73413.000000000 0.000
o 2 2 0 1 1 36144.833043045 0.069
o 2 3 0 1 1 0.560000000 0.010
o 2 4 0 1 1 232.342353773 0.020
o 2 5 0 1 1 7.062319637 0.000
o 2 6 0 1 1 0.480000000 0.250
o 2 7 0 1 1 0.000000000 5.730
o 2 8 0 1 1 0.000000000 0.100
o 2 9 0 1 1 0.000000000 0.100
o 2 10 0 1 1 0.000000000 0.100
o 2 11 0 1 1 0.000000000 0.100

o 3 1 0 1 1 365.256360000 0.100
o 3 2 0 1 1 51548.116292363 0.006
o 3 3 0 1 1 0.016710220 0.001
o 3 4 0 1 1 295.418908132 0.005
o 3 5 0 1 1 0.001042508 0.000
o 3 6 0 1 1 0.000036626 0.000
o 3 7 0 1 1 0.000009111 0.000
o 3 8 0 1 1 0.000000000 0.100
o 3 9 0 1 1 0.000000000 0.100
o 3 10 0 1 1 0.000000000 0.100
o 3 11 0 1 1 0.000000000 0.100


and get file 3:



o 0 1 0 1 1  5.732821           0.46744E-05 
o 0 2 1 1 1 54002.835589759 0.7
o 0 3 0 1 1 0.0883 -0.010
o 0 4 1 1 1 150.639327248 2.1
o 0 5 1 1 1 108.385358471 0.5
o 0 6 0 1 1 0.38 -0.04
o 0 7 0 1 1 0.00422 0.000057
o 2 1 0 1 1 73413.0 0.0001
o 2 2 1 1 1 36144.833043045 105.0
o 2 3 0 1 1 0.56 0.01
o 2 4 1 1 1 232.342353773 10.0
o 2 5 1 1 1 7.062319637 2.0
o 2 6 0 1 1 0.48 0.25
o 3 1 0 1 1 365.256360000 0.1
o 3 2 1 1 1 51548.116292363 10.0
o 3 3 0 1 1 0.016710220 0.001
o 3 4 1 1 1 295.418908132 10.0
o 3 5 1 1 1 0.001042508 0.0001
o 3 6 0 1 1 0.000036626 0.000001
o 3 7 0 1 1 0.000009111 0.00000001


enter image description here



I care about this numbers that are indentified by the number in second and third column in all three files. So I want to replace these numbers in file 1 with numbers in file 2 and the result is file 3.



MINIMALISTIC PROBLEM



I have a file A



o 0 1 0 1 1  40          
o 0 2 1 1 1 50


And I want to replace number in row, where is in the second column number 0 and in the 3rd column number 2. So I want to replace number 50. I would like to replace number 50 with number, that is in the another file B:



o 0 1 0 1 1  48          
o 0 2 1 1 1 55


This number is in row, where is in the second column number 0 and in the 3rd column number 2 too. So it should be replaced by 55. I expect the output



o 0 1 0 1 1  40          
o 0 2 1 1 1 55






awk






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 31 '18 at 19:33







Elisabeth

















asked Dec 30 '18 at 11:22









ElisabethElisabeth

1636




1636








  • 3





    ?? Please explain what you are trying to do rather than post code that doesn't do what you want. Are you trying to replace occurrences of 0,2 and 3 in column 2 with 2,4 and 5? Or are you trying to replace 2,4 and 5 in column 3 with values from column 3 of the other file? Or are your replacement values in column 8? Provide a clearer description and sample input along with the desired output.

    – William Pursell
    Dec 30 '18 at 11:41











  • I editted the question

    – Elisabeth
    Dec 30 '18 at 12:12











  • Hmmm, still not clear I think. I guess you should should show Input1, Input2 and Outpur clearly marked, so that we can better understand the logic behind your question.

    – vaettchen
    Dec 30 '18 at 13:59











  • Is it fine now?

    – Elisabeth
    Dec 30 '18 at 14:25











  • You are matching <0 or 2 or 3>; if you intend for the anchors to govern all these numbers, you want <(0|2|3)> (which can be simplified to <[023]> as long as all the numbers are a single digit). But this is just a detail; I still have no idea what you want.

    – tripleee
    Dec 30 '18 at 14:44














  • 3





    ?? Please explain what you are trying to do rather than post code that doesn't do what you want. Are you trying to replace occurrences of 0,2 and 3 in column 2 with 2,4 and 5? Or are you trying to replace 2,4 and 5 in column 3 with values from column 3 of the other file? Or are your replacement values in column 8? Provide a clearer description and sample input along with the desired output.

    – William Pursell
    Dec 30 '18 at 11:41











  • I editted the question

    – Elisabeth
    Dec 30 '18 at 12:12











  • Hmmm, still not clear I think. I guess you should should show Input1, Input2 and Outpur clearly marked, so that we can better understand the logic behind your question.

    – vaettchen
    Dec 30 '18 at 13:59











  • Is it fine now?

    – Elisabeth
    Dec 30 '18 at 14:25











  • You are matching <0 or 2 or 3>; if you intend for the anchors to govern all these numbers, you want <(0|2|3)> (which can be simplified to <[023]> as long as all the numbers are a single digit). But this is just a detail; I still have no idea what you want.

    – tripleee
    Dec 30 '18 at 14:44








3




3





?? Please explain what you are trying to do rather than post code that doesn't do what you want. Are you trying to replace occurrences of 0,2 and 3 in column 2 with 2,4 and 5? Or are you trying to replace 2,4 and 5 in column 3 with values from column 3 of the other file? Or are your replacement values in column 8? Provide a clearer description and sample input along with the desired output.

– William Pursell
Dec 30 '18 at 11:41





?? Please explain what you are trying to do rather than post code that doesn't do what you want. Are you trying to replace occurrences of 0,2 and 3 in column 2 with 2,4 and 5? Or are you trying to replace 2,4 and 5 in column 3 with values from column 3 of the other file? Or are your replacement values in column 8? Provide a clearer description and sample input along with the desired output.

– William Pursell
Dec 30 '18 at 11:41













I editted the question

– Elisabeth
Dec 30 '18 at 12:12





I editted the question

– Elisabeth
Dec 30 '18 at 12:12













Hmmm, still not clear I think. I guess you should should show Input1, Input2 and Outpur clearly marked, so that we can better understand the logic behind your question.

– vaettchen
Dec 30 '18 at 13:59





Hmmm, still not clear I think. I guess you should should show Input1, Input2 and Outpur clearly marked, so that we can better understand the logic behind your question.

– vaettchen
Dec 30 '18 at 13:59













Is it fine now?

– Elisabeth
Dec 30 '18 at 14:25





Is it fine now?

– Elisabeth
Dec 30 '18 at 14:25













You are matching <0 or 2 or 3>; if you intend for the anchors to govern all these numbers, you want <(0|2|3)> (which can be simplified to <[023]> as long as all the numbers are a single digit). But this is just a detail; I still have no idea what you want.

– tripleee
Dec 30 '18 at 14:44





You are matching <0 or 2 or 3>; if you intend for the anchors to govern all these numbers, you want <(0|2|3)> (which can be simplified to <[023]> as long as all the numbers are a single digit). But this is just a detail; I still have no idea what you want.

– tripleee
Dec 30 '18 at 14:44












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53977194%2fawk-replace-number-in-file-from-numbers-in-another-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53977194%2fawk-replace-number-in-file-from-numbers-in-another-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'