Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

sed Doesn't Trim Whitespace from EOL

Help
2008-05-01
2013-04-24
  • Paul Massey
    Paul Massey
    2008-05-01

    I have been trying for the longest time to get sed to find the EOL.  I just wanted to append some data to the end of every line of a file but I can never seem to get SED to understand the end of a line.  Does the period dollar sign mean end of line in DOS?

     
    • Jason Anderson
      Jason Anderson
      2008-05-01

      This works for me: sed /$/hi/

      Did you check your line endings, as described in the thread you replied to?  I'm not sure what line endings my test file has.

       
  • Greg
    Greg
    2008-05-02

    Why not just use the character class [[:space:]]?

    Like this:

    echo "line       " | sed 's/[[:space:]]*$//g'

    This will remove any and all spaces up to the EOL.