Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I have some text files I'm trying to sort. I want a utility that is able to insert a newline character after each specified character. (BASH Scripting) So for ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Posts
    1

    Insert NewLine Character


    Hi,

    I have some text files I'm trying to sort. I want a utility that is able to insert a newline character after each specified character. (BASH Scripting)

    So for instance:

    Code:
    The Quick: Brown Fox: Jumps Over: The Lazy Dog
    Turns into
    Code:
    The Quick:
    Brown Fox:
    Jumps Over:
    The Lazy Dog
    Where the Colon ( : ) is the indicator of where to put the newline.

    I don't know how to use sed, (I'd like to learn), so an explanation would be appreciated.

    I've searched high and low looking for answers, and have come close, but not close enough.

    Thanks for any answers,

    Stefer

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Read the sed manpage:
    Code:
    man sed
    Pay attention to the bit on:
    Code:
    s/regexp/replacement/
    Also, look at examples of sed in the scripts in /etc/init.d/ directory - there are plenty of sed examples there.

Posting Permissions

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