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!

awk/sed question 1

Status
Not open for further replies.

ianicr

IS-IT--Management
Nov 4, 2003
230
GB
Is there a way using awk/sed to add a space after the 4th character of a file on each line? eg. I have a file with
NE234GJ
NE345HJ
that I wish to be
NE23 4GJ
NE34 5HJ

Any help would be grately appreciated.
Thanks
 
sed 's/\(.\{4\}\)\(.*\)/\1 \2/' filename

tikual
 
Thanks for the speedy response. This works great!
 
Even simpler:
Code:
sed 's/^\(.\{4\}\)/\1 /' filename

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top