I am stuck on the last step and hope someone could help me out.
I have 2 files:
file1 =
Green Apple
file2 =
Green Apple/quantity/100
Red Peach/quantity/200
My code:
grep -f file1 file2 | sed ‘s/quantity(.*)/totalXYZ/’
= Green Apple/totalXYZ
I would like to apply it to file2 so the result would look like this:
file2 =
Green Apple/totalXYZ
Red Peach/quantity/200
Thanks
You can get it using AWK this way:
The code of “grepandreplace.awk” is:
And I got your desired output:
Any questions? leave me a comment.