string - Mask data in a specific postion and specific record type -
updated:
i have file quite big. need mask characters in specific postions , specific record type. have searched on place cannot find solution of quite simple task. here example
file name: hello.txt
file:
0120140206input file
1032682842 mr simpson
20231458 742 evergreen terrace
3034560817 green
1032682842 mr griffin
20231458 spooner street
3034560817 red
3001
what mask position 12-16 of lines starting 10. this:
0120140206input file
1032682842 xxxxxmpson
20231458 742 evergreen terrace
3034560817 green
1032682842 xxxxxiffin
20231458 spooner street
3034560817 red
3001
try this:
sed 's/^\(10[0-9]\+[ \t]\+\).*$/\1xxxxxxxxxxxxx/g'
example:
sed 's/^\(10[0-9]\+[ \t]\+\).*$/\1xxxxxxxxxxxxx/g' <<< "0120140206input file 1032682842 mr simpson 20231458 742 evergreen terrace 9001"
Comments
Post a Comment