SPUG: reg pattern matching in a loop
Devin Ben-Hur
dbenhur at whitepages.com
Fri Oct 14 17:47:55 PDT 2011
On 10/14/2011 04:01 PM, Noah Rømer wrote:
> If you don't want
> to condense multiple spaces into a single '|' (' ' -> '|'), but want
> a '|' for each space char (' ' -> '||||'), then the 'tr' command is
> your friend
>
> tr/ /|/;
>
> This will replace every space found with a pipe character.
Perl's transliterate will happily condense multiple substitutions to the
same character. The squash option tells it to do so: tr/ /|/s;
More information about the spug-list
mailing list