$ echo '[[HelloInCapitals]] OrAnd [[PharmaceuticalSocietyOfGreatBritainVBoots1952]]' | perl -pe's/\B(?:[[:upper:]]|\d+)\B/ $&/g'
[[Hello In Capitals]] Or And [[Pharmaceutical Society Of Great Britain VBoots 1952]]
This should also take care for the numbers, if you want to process only words. For lines including words within double square brackets use one of those solutions above.
Code:
sed 's/[A-Z]/ &/g; s/[0-9][0-9]*/ &/g; s/\[ /\[/g'
zsh-4.3.10[t]% print '[[HelloInCapitals]] AndOr [[PharmaceuticalSocietyOfGreatBritainVBoots1952]]' |
perl -pe'
s/\Q[[\E(.*?)\Q]]\E/($x=$1)=~s#\B([[:upper:]]|\d+)\B# $1#g;"[[".$x."]]"/eg
'
[[Hello In Capitals]] AndOr [[Pharmaceutical Society Of Great Britain V Boots 1952]]
---------- Post updated at 03:17 PM ---------- Previous update was at 03:15 PM ----------
Quote:
Originally Posted by Franklin52
This should also take care for the numbers, if you want to process only words. For lines including words within double square brackets use one of those solutions above.
Code:
sed 's/[A-Z]/ &/g; s/[0-9][0-9]*/ &/g; s/\[ /\[/g'
This one substitutes outside of the [[ ]] as well.
I've a very trivial thing bothering me. I'm rather new in scripting so I'll keep asking stupid questions.
Here is small script that does backup of mails.
---
for i in `cat /maildir.dir`
do
echo $i
maildir=`echo $i|sed 's@^./usr/@@'`
for j in $i/*
do
&& {
st="`find $j/backup -name "*"... (3 Replies)