Example file having 6 columns with ";" separator:
temp;abcd;YES;1234;pqrs;YES
aaaa;bccc;YES;1234;pqrs;YES
ramy;uqq;YES;adda;1234;YES
..
..
..
Now Search for multiple patterns(pattern to be searched can be 1 or more) say temp and bccc, and replacing the 6th(or the last) delimited word with NO, in the line that matched the pattern.
i.e expected output should be
temp;abcd;YES;1234;pqrs;NO
aaaa;bccc;YES;1234;pqrs;NO
ramy;uqq;YES;adda;1234;YES
..
..
..
It would be really good to have in-file editing, as I would be using the code in a recursive loop, where multiple patterns to be searched would be dynamically assigned in a shell variable.
Something like this:
var='temp|abcd'
grep $var filename |
based on pattern matched, replace the 6th or last work with a NO, with file having a ; delimiter.