I have file where I need to modify some lines for every account.The line which I need to modify looks like as below:PstlInfo <some content>  NNYYYN (Every account will have this line)the NNYYNN (always Y or N only 6 positions) starts at the postion 150now for every account I need to modify only the above line starts with PstlInfo as belowPstlInfo <some content>  NNNNNN (whatever the above line I need to set asNNNNNN)Every time I am doing it manually by opening file in vi editor, I want to change the only the contents which are starting from position 150 (5 positions only).If there are few accounts it is easy to modify else it is very tedious job, is there any way that I can modify file at one shot where the line starts with PstlInfo
Replace or modify file contents at one shot
files;ksh;aix;replace
I see you are using AIX. It has a sed command which should be able to do the following:sed '/^PstlInfo/s/^\(.\{150\}\)[NY]\{6\}/\1NNNNNN/' <yourfile >newfileThis replaces, on lines beginning PstlInfo, any 6 chars formed of N or Y ([NY]\{6\}) by NNNNNN, at position 150 chars (^.\{150\}) from the start of line. Those 150 chars are copied (\(...\)) and restored in the replacement string (\1).