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!

reading in file delimited with *

Status
Not open for further replies.

dwcasey

MIS
Oct 31, 2002
179
US
I have a huge, one line file. I need to delimit at every asterisk * and create a new line.

something like

5|12345 North Street|Smallville|KS|Bob|Smith|5552221212*5|12345 North Street|Smallville|KS|Bob|Smith|5552221212*5|12345 North Street|Smallville|KS|Bob|Smith|5552221212*5|12345 North Street|Smallville|KS|Bob|Smith|5552221212*

So that when I read in the file, if I hit an asterisk, I create a newline:

5|12345 North Street|Smallville|KS|Bob|Smith|5552221212*
5|12345 North Street|Smallville|KS|Bob|Smith|5552221212*
5|12345 North Street|Smallville|KS|Bob|Smith|5552221212*
5|12345 North Street|Smallville|KS|Bob|Smith|5552221212*

 
A starting point:
tr '*' '\n' </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 FAQ181-2886
 
Reply to my own post

tr '*' '\n' < file.txt > file.new
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top