Can anyone help me to search for multiple strings within specified position and replace with respective string value.
For example I need to search the string from the position 11 to 20 and if it contain ABC and then replace it by BCDEFGHIJ ... find AABZSDJIK and replace with QWE. and so on.. The file may have 50000 records and I need to search and replace with 10 different values. I can't use perl script please let me know the best way to achive this in UNIX script.
Thanks for your reply. My requirement is slightly different. Search for different set of string and replace with respective value with accurate field position. For example i want to search specific set of strings from 25 to 35 and repalce with corresponding values. If replacing value has 10 character then remaining 5 character should be filled with space so that the next value starting from 36 is not shifted to left column.
find from 25 to 35 -- replace with
2FMDK38C39B--AAAAAAAAAAA
1FMEU64 --BBBB
5LMFU275 --CCCCC
1ZVHT82H28 --DD
--Nodata
If you are doing this yourself, perhaps this is something you can build upon. This would need to read in the pairs of strings, old and new, then search each line for old in the second field: