Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacing characters with awk/substr

Status
Not open for further replies.

qusan

Technical User
Jun 8, 2004
2
US
Would using awk's substr in this manner be feasible? I am trying to replace characters 35-42 with zeroes for every record in a file.


runid = substr($0,35,8)
zeroed ="00000000"
runid=zeroed
 
Try something like this:
awk '
{print substr($0,1,34)"00000000"substr($0,43)}
' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top