If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Sed - Make new line?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-08-05, 13:10
old_farmer old_farmer is offline
Registered User
 
Join Date: Feb 2005
Posts: 19
Sed - Make new line?

How do I use sed to make a new line in a file (test.txt) everytime it has a bar and then a space - like this:

some text| some other test |


Any ideas? Thanks a lot!
Reply With Quote
  #2 (permalink)  
Old 02-08-05, 13:26
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
nawk 'BEGIN{FS="[|] ";OFS="\n"} $1=$1' file
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #3 (permalink)  
Old 02-08-05, 15:36
old_farmer old_farmer is offline
Registered User
 
Join Date: Feb 2005
Posts: 19
I get a nawk: not found error when I run that code. Does that mean that my Shell doesn't support nawk? Thanks a lot
Reply With Quote
  #4 (permalink)  
Old 02-08-05, 15:38
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
try it with 'awk' or 'gawk'
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #5 (permalink)  
Old 02-08-05, 15:45
old_farmer old_farmer is offline
Registered User
 
Join Date: Feb 2005
Posts: 19
awk worked great. Thanks again
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On