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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert newlines in data file 2

Status
Not open for further replies.

teram

Technical User
Oct 9, 2001
1
US

In a unix environment, I have a data file with a few thousand rows of undelimited ascii data (no delimiters; contiguous data).

I need to convert this contiguous data file into a file of 22 character rows.

How can I use AWK to add a newline after every 22 characters? Does using AWK to add (/n) sound like the best approach?

Thanks for the help,
teram
 
Hi teram,

I suggest using fold

fold -22 contiguous-file > new-file

Hope this helps.
CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top