Jun 8, 2004 #1 qusan Technical User Jun 8, 2004 2 US I have a file with multiple records: 0287C04200302201511330000000133986589898989 160180 00000001xxxx_xxxx_020_xxxxx.dat I need to change characters 35-42 to zeros. Is there a substitution command to do this with awk or sed?
I have a file with multiple records: 0287C04200302201511330000000133986589898989 160180 00000001xxxx_xxxx_020_xxxxx.dat I need to change characters 35-42 to zeros. Is there a substitution command to do this with awk or sed?
Jun 8, 2004 #2 CaKiwi Programmer Apr 8, 2001 1,294 US awk solution (untested) awk '{print substr($0,1,34) "00000000" substr($0,43)}' infile > outfile Somebody will be along with the sed solution soon CaKiwi Upvote 0 Downvote
awk solution (untested) awk '{print substr($0,1,34) "00000000" substr($0,43)}' infile > outfile Somebody will be along with the sed solution soon CaKiwi
Jun 9, 2004 #3 stefanwagner Programmer Oct 19, 2003 2,373 DE # # substitute 12....345...678 -> 12...340...078 # s/^\(.\{34\}\)\(.\{7\}\)\(.*\)/\10000000\3/g seeking a job as java-programmer in Berlin: http://home.arcor.de/hirnstrom/bewerbung Upvote 0 Downvote
# # substitute 12....345...678 -> 12...340...078 # s/^\(.\{34\}\)\(.\{7\}\)\(.*\)/\10000000\3/g seeking a job as java-programmer in Berlin: http://home.arcor.de/hirnstrom/bewerbung