{"thread":{"id":"4302","subject":"[SCRIPT] chomp: trim trailing whitespace","startedAt":"2006-05-27T02:27:17Z","lastAt":"2006-05-28T10:00:01Z","messageCount":11,"participants":["Jeff Garzik","Jan Engelhardt","Thomas Glanzmann","Neil Brown","Dmitry Fedorov","Martin Langhoff","Linus Torvalds","Keith Owens","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"20771","messageId":"4477B905.9090806@garzik.org","threadId":"4302","inReplyTo":null,"subject":"[SCRIPT] chomp: trim trailing whitespace","fromName":"Jeff Garzik","fromEmail":"jeff@garzik.org","sentAt":"2006-05-27T02:27:17Z","receivedAt":"2006-05-27T02:27:17Z","isPatch":false,"sender":{"key":"jeff@garzik.org","avatar":null},"body":"\nAttached to this email is chomp.pl, a Perl script which removes trailing \nwhitespace from several files.  I've had this for years, as trailing \nwhitespace is one of my pet peeves.\n\nNow that git-applymbox complains loudly whenever a patch adds trailing \nwhitespace, I figured this script may be useful to others.\n\n\tJeff\n\n\n\n"},{"id":"20784","messageId":"Pine.LNX.4.61.0605271212210.6670@yvahk01.tjqt.qr","threadId":"4302","inReplyTo":"4477B905.9090806@garzik.org","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Jan Engelhardt","fromEmail":"jengelh@linux01.gwdg.de","sentAt":"2006-05-27T10:15:59Z","receivedAt":"2006-05-27T10:15:59Z","isPatch":false,"sender":{"key":"jengelh@linux01.gwdg.de","avatar":null},"body":"> Attached to this email is chomp.pl, a Perl script which removes trailing\n> whitespace from several files.  I've had this for years, as trailing whitespace\n> is one of my pet peeves.\n>\n> Now that git-applymbox complains loudly whenever a patch adds trailing\n> whitespace, I figured this script may be useful to others.\n>\n\nPretty long script. How about this two-liner? It does not show 'bytes \nchomped' but it also trims trailing whitespace.\n\n#!/usr/bin/perl -i -p\ns/[ \\t\\r\\n]+$//\n\n\n\nJan Engelhardt\n-- \n"},{"id":"20786","messageId":"20060527102439.GB26430@cip.informatik.uni-erlangen.de","threadId":"4302","inReplyTo":"Pine.LNX.4.61.0605271212210.6670@yvahk01.tjqt.qr","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Thomas Glanzmann","fromEmail":"sithglan@stud.uni-erlangen.de","sentAt":"2006-05-27T10:24:39Z","receivedAt":"2006-05-27T10:24:39Z","isPatch":false,"sender":{"key":"sithglan@stud.uni-erlangen.de","avatar":null},"body":"Hello,\n\n> #!/usr/bin/perl -i -p\n> s/[ \\t\\r\\n]+$//\n\nperl -p -i -e 's/\\s+$//' file1 file2 file3 ...\n\n        Thomas\n"},{"id":"20790","messageId":"17528.11171.347324.526827@cse.unsw.edu.au","threadId":"4302","inReplyTo":"20060527102439.GB26430@cip.informatik.uni-erlangen.de","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Neil Brown","fromEmail":"neilb@suse.de","sentAt":"2006-05-27T10:36:19Z","receivedAt":"2006-05-27T10:36:19Z","isPatch":false,"sender":{"key":"neilb@suse.de","avatar":"https://gravatar.com/avatar/550a4445c91cb1d8120493c6079a980b8cf7d6e172ab74424a0b72a693291d19?d=mp&s=160"},"body":"On Saturday May 27, sithglan@stud.uni-erlangen.de wrote:\n> Hello,\n> \n> > #!/usr/bin/perl -i -p\n> > s/[ \\t\\r\\n]+$//\n> \n> perl -p -i -e 's/\\s+$//' file1 file2 file3 ...\n> \n\nUhm... have either of you actually tried those?  When I tried, I lose\nall the '\\n' characters :-(\n\n  perl -pi -e 's/[ \\t\\r]+$//'  *.[ch]\n\nseems to actually work.\n\nNeilBrown\n"},{"id":"20791","messageId":"447838EB.9060900@garzik.org","threadId":"4302","inReplyTo":"Pine.LNX.4.61.0605271212210.6670@yvahk01.tjqt.qr","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Jeff Garzik","fromEmail":"jeff@garzik.org","sentAt":"2006-05-27T11:32:59Z","receivedAt":"2006-05-27T11:32:59Z","isPatch":false,"sender":{"key":"jeff@garzik.org","avatar":null},"body":"Jan Engelhardt wrote:\n>> Attached to this email is chomp.pl, a Perl script which removes trailing\n>> whitespace from several files.  I've had this for years, as trailing whitespace\n>> is one of my pet peeves.\n>>\n>> Now that git-applymbox complains loudly whenever a patch adds trailing\n>> whitespace, I figured this script may be useful to others.\n>>\n> \n> Pretty long script. How about this two-liner? It does not show 'bytes \n> chomped' but it also trims trailing whitespace.\n> \n> #!/usr/bin/perl -i -p\n> s/[ \\t\\r\\n]+$//\n\nYes, it does, but a bit too aggressive for what we need :)\n\n\tJeff\n"},{"id":"20792","messageId":"7115951b0605270448ge8c45e8ha01c35e6d415e419@mail.gmail.com","threadId":"4302","inReplyTo":"447838EB.9060900@garzik.org","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Dmitry Fedorov","fromEmail":"dm.fedorov@gmail.com","sentAt":"2006-05-27T11:48:29Z","receivedAt":"2006-05-27T11:48:29Z","isPatch":false,"sender":{"key":"dm.fedorov@gmail.com","avatar":null},"body":"Jan Engelhardt wrote:\n>> Attached to this email is chomp.pl, a Perl script which removes trailing\n>> whitespace from several files.  I've had this for years, as\ntrailing whitespace\n>> is one of my pet peeves.\n\nAnd my scripts.\n"},{"id":"20795","messageId":"Pine.LNX.4.61.0605271441080.4857@yvahk01.tjqt.qr","threadId":"4302","inReplyTo":"447838EB.9060900@garzik.org","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Jan Engelhardt","fromEmail":"jengelh@linux01.gwdg.de","sentAt":"2006-05-27T12:42:02Z","receivedAt":"2006-05-27T12:42:02Z","isPatch":false,"sender":{"key":"jengelh@linux01.gwdg.de","avatar":null},"body":">> Pretty long script. How about this two-liner? It does not show 'bytes\n>> chomped' but it also trims trailing whitespace.\n>> \n>> #!/usr/bin/perl -i -p\n>> s/[ \\t\\r\\n]+$//\n>\n> Yes, it does, but a bit too aggressive for what we need :)\n>\nWhoops, should have been s/[ \\t\\r]+$//\nAnd the CL form is\n  perl -i -pe '...'\n\nSomehow, you can't group it to -ipe, but who cares.\n\n\nJan Engelhardt\n-- \n"},{"id":"20799","messageId":"46a038f90605270828u7842ea48hda07331388694db2@mail.gmail.com","threadId":"4302","inReplyTo":"4477B905.9090806@garzik.org","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-05-27T15:28:57Z","receivedAt":"2006-05-27T15:28:57Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"I love perl golf for this kind of stuff... but git-stripspace is part\nof git already. Even then, I tend to do it with perl -pi -e ''\nconstructs ;-)\n\ncheers,\n\n\nm\n"},{"id":"20800","messageId":"Pine.LNX.4.64.0605270905190.5623@g5.osdl.org","threadId":"4302","inReplyTo":"46a038f90605270828u7842ea48hda07331388694db2@mail.gmail.com","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-05-27T16:13:03Z","receivedAt":"2006-05-27T16:13:03Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 28 May 2006, Martin Langhoff wrote:\n>\n> I love perl golf for this kind of stuff... but git-stripspace is part\n> of git already. Even then, I tend to do it with perl -pi -e ''\n> constructs ;-)\n\nWell, git-stripspace actually does something slightly differently, in that \nit also removes extraneous all-whitespace lines from the beginning, the \nend, and the middle (in the middle, the rule is: two or more empty lines \nare collapsed into one).\n\nIe it's a total hack for parsing just commit messages (and it is in C, \nbecause I can personally write 25 lines of C in about a millionth of the \ntime I can write 3 lines of perl).\n\n\t\tLinus\n"},{"id":"20817","messageId":"8694.1148805194@ocs3.ocs.com.au","threadId":"4302","inReplyTo":"Pine.LNX.4.61.0605271441080.4857@yvahk01.tjqt.qr","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Keith Owens","fromEmail":"kaos@ocs.com.au","sentAt":"2006-05-28T08:33:14Z","receivedAt":"2006-05-28T08:33:14Z","isPatch":false,"sender":{"key":"kaos@ocs.com.au","avatar":null},"body":"Jan Engelhardt (on Sat, 27 May 2006 14:42:02 +0200 (MEST)) wrote:\n>And the CL form is\n>  perl -i -pe '...'\n>Somehow, you can't group it to -ipe, but who cares.\n\n-i takes an optional extension which is used to optionally create\nbackup files.  As such, -i must be followed by space if you want no\nextension (and no backup).\n"},{"id":"20819","messageId":"Pine.LNX.4.63.0605281157330.1862@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4302","inReplyTo":"Pine.LNX.4.64.0605270905190.5623@g5.osdl.org","subject":"Re: [SCRIPT] chomp: trim trailing whitespace","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-05-28T10:00:01Z","receivedAt":"2006-05-28T10:00:01Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 27 May 2006, Linus Torvalds wrote:\n\n> Well, git-stripspace actually does something slightly differently, in that \n> it also removes extraneous all-whitespace lines from the beginning, the \n> end, and the middle (in the middle, the rule is: two or more empty lines \n> are collapsed into one).\n> \n> Ie it's a total hack for parsing just commit messages (and it is in C, \n> because I can personally write 25 lines of C in about a millionth of the \n> time I can write 3 lines of perl).\n\nBut there is no good reason not to add some code and a command line \nswitch, so that this tool with a very generic name actually performs what \na normal person would expect from that name.\n\nCiao,\nDscho\n"}]}