<[EMAIL PROTECTED]> wrote:

> I have a string that looks like
> 
> Operator Overview#PGM#Report about all configured
> operators#/opt/OV/bin/OpC/call_sqlplus.sh all_oper#
> 
> I want to replace the last "#" with a newline. I've come up with a few ideas
> like
> 
> substr ($_, rindex ($_, "#"), 1) = "\n" ;
> or
> substr ($_, length ($_) - 1, 1) = "\n" ;
> or
> chop ; $_ .= "\n" ;
> 
> Are there any better ways, maybe using s/// or tr/// ? TIA...
> 

This is horrible, but works :)
s/(.+)#(.+)$/$1\n$2/

It will always match greedy, so it will always match the last # on the line
:)

Tor


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to