Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Posts
    19

    Unanswered: 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!

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    nawk 'BEGIN{FS="[|] ";OFS="\n"} $1=$1' file
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  3. #3
    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

  4. #4
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    try it with 'awk' or 'gawk'
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  5. #5
    Join Date
    Feb 2005
    Posts
    19
    awk worked great. Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •