Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Should be | 8 comments | Create New Account
Click here to return to the 'Should be' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Should be
Authored by: lonestar on Jan 25, '07 10:13:49AM

I agree. This hint definitely is not a mac hint and has no place here. But since it is, it should at least be correct. The backslashes are missing and it is a poor solution anyway. It replaces all <letter><dot><letter> with spaces, but likely this is not what you want if your file has abbreviations (i.e. I.B.M.) or filenames.

Much better to make sure the case of the first letter is lowercase and the case of the second letter is uppercase.

perl -pe 's/([a-z]\.)([A-Z])/$1 $2/g'



[ Reply to This | # ]
Should be
Authored by: dzurn on Jan 25, '07 01:54:36PM
I agree. This hint definitely is not a mac hint and has no place here. But since it is, it should at least be correct. The backslashes are missing and it is a poor solution anyway. It replaces all with spaces, but likely this is not what you want if your file has abbreviations (i.e. I.B.M.) or filenames.

Much better to make sure the case of the first letter is lowercase and the case of the second letter is uppercase.

perl -pe 's/([a-z].)([A-Z])/$1 $2/g'

I disagree that it's not related to Mac OS X. The underpinnings of OS X definitely are Unix (to whatever degree the purists would argue) and these tools are always there.

Besides, the more I learned about Regular Expressions, the better my life became :)

I added a quote to your script so that the offered sample text would at least resolve properly.

perl -pe 's/([a-z].)([A-Z"])/$1 $2/g'

It worked to replace all three messed-up punctuation marks in the sample.

My new sig: "There is more Unix-nature in one line of shell script than there is in ten thousand lines of C" --Rootless Root

---
Madness takes its toll.
Please have exact change.

[ Reply to This | # ]

Should be
Authored by: mastige on Jan 26, '07 11:16:50AM
perl -pe 's/([a-z].)([A-Z"])/$1 $2/g'
I tried this on the supplied text. It puts a space between the exclamation mark and the double quote. Correct is:
perl -pe 's/([a-z.])([A-Z"])/$1 $2/g'


[ Reply to This | # ]