On Mon, 2003-10-06 at 12:31, Lukas Ruf wrote: > Dear all, > > although I know it isn't anything that directly refers to Debian, I > dare to post since I have seen many similar questions. Please excuse!
It's not off topic for debian-user. > The Problem: from a friend, I receive text-files that have a lot of > whitespace before the end of a line or even lines consisting of only > whitespace. For this reason, I set up a Makefile that would remove > all whitespaces: > ## > receive: > cat in_file \ > | sed -e 's/\s*$$//' \ > > new_in_file > ## > I expect this to remove all whitespaces '\s*'ending a line. > > But, funny enough, it removes all 's' ending a line. This has been > driving me mad for a couple of hours.... that's why I dare to post. > > What's wrong with 's/\s*$$//' in a Makefile? > I tried 's/\\s*$$//' -- with no success. > > Hopefully someone immediately sees the problem and can give me any > hint. You are trying to use a Perl regular expression with sed; that doesn't work. Although the sed manpage refers to perlre, sed does not seem to support Perl regular expressions. You should look at man 7 regexp instead. Try: sed -r -e 's/[[:space:]]+$$//' NB, you don't need to do "cat in_file | sed [pattern]"; you can do "sed [pattern] in_file" -- Oliver Elphick [EMAIL PROTECTED] Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Blessed is the man that walketh not in the counsel of the ungodly, nor standeth in the way of sinners, nor sitteth in the seat of the scornful. But his delight is in the law of the LORD; and in his law doth he meditate day and night." Psalms 1:1,2 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]