tag:blogger.com,1999:blog-5215296.post4659994702339809255..comments2023-10-30T13:33:16.424+00:00Comments on Manav Gupta: Perl one liner for dos2unixManav Guptahttp://www.blogger.com/profile/11490499610426074464noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-5215296.post-13810853369702312382022-11-28T12:29:35.414+00:002022-11-28T12:29:35.414+00:00nice article thanksnice article <a href="https://kaavannan-perl.blogspot.com/2021/08/perl-rest-client-crud-tutorial-example.html" rel="nofollow">thanks</a>www.kaavannan-perl.blogspot.comhttps://www.blogger.com/profile/12159899709175261104noreply@blogger.comtag:blogger.com,1999:blog-5215296.post-19632843601378415992019-10-10T18:10:48.221+01:002019-10-10T18:10:48.221+01:00Nice. great Article Thanks..Nice. great <a href="http://www.lets-crack-perl-interview.blogspot.com" rel="nofollow">Article</a> Thanks..https://www.blogger.com/profile/01044465043207599220noreply@blogger.comtag:blogger.com,1999:blog-5215296.post-89688229979279375712013-11-04T20:38:17.695+00:002013-11-04T20:38:17.695+00:00perl -MExtUtils::Command -e dos2unix fileperl -MExtUtils::Command -e dos2unix fileAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215296.post-32494343757523532722013-07-31T16:19:15.285+01:002013-07-31T16:19:15.285+01:00"Now how to make it recursive?"
find tr..."Now how to make it recursive?"<br /><br />find tree_root -type f -print0 | xargs -0 perl -pi -e 's/\r\n/\n/g'<br /><br />Where tree_root is the directory you want to start in, use . for the current directory. To only do certain filenames:<br /><br />find tree_root -type f -name '*.ext' -print0 ...<br /><br />The quotes are to avoid having bash apply the glob in your Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215296.post-80563519643644824542012-12-11T20:33:16.312+00:002012-12-11T20:33:16.312+00:00It's change all lines in file but it isn't...It's change all lines in file but it isn't recursive (don't change all files in directory and sub-directories, it's change only files "visible by *").<br />It's change all lines because of '-p' switch:<br />$ perl -MO=Deparse -e 's/\r\n/\n/' <br />s/\r\n/\n/;<br />$ perl -MO=Deparse -pe 's/\r\n/\n/'<br />LINE: while (defined($_ = )) {<br />Dominikhttps://www.blogger.com/profile/16700013032495712731noreply@blogger.comtag:blogger.com,1999:blog-5215296.post-9526764229733995152012-07-12T14:00:02.502+01:002012-07-12T14:00:02.502+01:00Holy thread revival!!!
Might be a suggeston to th...Holy thread revival!!!<br /><br />Might be a suggeston to throw a $ in there, just to make sure it only acts on the end of each line.<br /><br />I've seen a few examples of dos2unix (older version, admittedly) where it stripped what it thought were Windows control characters from a UTF8 file, when in fact they were content.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215296.post-90332615794739693912012-04-27T18:46:05.706+01:002012-04-27T18:46:05.706+01:00It already recursive because of the "g" ...It already recursive because of the "g" on the end (global). Without the "g", it would only replace the first instance of \r\n with \n.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215296.post-38584323997812313422012-03-14T23:58:32.528+00:002012-03-14T23:58:32.528+00:00Now how to make it recursive?Now how to make it recursive?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215296.post-20854916562230886722012-03-01T07:36:07.272+00:002012-03-01T07:36:07.272+00:00very usefulvery usefulAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215296.post-54767566580693808012011-10-04T10:44:20.020+01:002011-10-04T10:44:20.020+01:00Good one. Thanks!Good one. Thanks!Chirag Radhakrishnanhttps://www.blogger.com/profile/08014497004862592500noreply@blogger.com