Find the answer to your Linux question:
Results 1 to 2 of 2
Originally Posted by scottro sed 's/$/;/' filename The s means substitute The $ in this particular regex (regular expression) means end of the line. The ; is what you're subbing. ...
  1. #1
    Just Joined!
    Join Date
    Aug 2010
    Posts
    5

    append a / at the end of the line

    Quote Originally Posted by scottro View Post
    sed 's/$/;/' filename

    The s means substitute
    The $ in this particular regex (regular expression) means end of the line.
    The ; is what you're subbing.
    This works fine and well, but what if you want to append a / at the end of the line?

    sed 's/$///' filename doesn't work.

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    Did you try with escape characters ?
    sed 's/$/\//g' file.txt
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

Posting Permissions

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