|
|
fixing Mac line breaks w/ PERL
There are many places where PERL is incredibly handy. This is one of them. You can use
fixing Mac line breaks w/ PERL
Perl is one thing that I would definitely like to learn more about. Thanks for showing me the
whre is .bashrc
how did u add the shortcut to .bashrc ?
whre is .bashrc
If you didn't install the BASH shell, then you won't have a .bashrc.
fixing Mac line breaks w/ PERL (without blank lines)
Using this can result in there being blank lines between each and every line that was there before.
fixing Mac line breaks w/ PERL (MULTIPLE FILES)
I found that I needed to do like 100 at a time and it wasn't going to cut it to pass one file at a time. This is what I did:
fixing Mac line breaks w/ PERL (MULTIPLE FILES)
You don't have to close your terminal. Just type "rehash". Note also that the path to your bin directory has to be in your PATH for this to work.
fixing Mac line breaks w/ PERL (MULTIPLE FILES)
A somewhat more helpful (for me) version of this script reads like this: ###### #!/bin/sh for filename in *.TXT do echo $filename perl -pi -e 's/rn?/n/g' "$filename" done ####### The -li is unnecessary and the files I happen to want to deal with are of the TXT sort. However, * would cover everything as well. The important change, though, is the quotes around $filename (or $T in the above example) so that file names with spaces in them are handled correctly by perl.
fixing Mac line breaks w/ PERL (MULTIPLE FILES)
Actually, even easier command, using find:
find . -type f -name "DEMO*" -exec perl -pi -e 's/\r/\n/g' \{\} \;
this changes all files starting with "DEMO". Obviously, you can change that to "*" or whatever suits your needs. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:Hints1 new Hints in the last 24 hoursComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.06 seconds |
|