Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex on the Command Line

Status
Not open for further replies.

Deleted

Technical User
Jul 17, 2003
470
US
This works as a script but fails on the command line

Any suggestions?
Code:
perl -pi -e "s/\'win\',\'width=[b](.*)[/b],height=[b](.*)[/b]\'\);/\'win\',\'width=[b]$1[/b],height=[b]$2[/b],resizable=1,scrollbars=1\'\);/gi" *htm
What is in bold fails

 
I suspect that the $1 and $2 are being interpreted by the unix shell and never get to perl. Don't know how you'd work round it on the command line though. Could you not put that line of code into a little script and run that?

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
just a thought, why not try (.*?) instead of what you currently have:
Code:
perl -pi -e "s/\'win\',\'width=(.*?),height=(.*?)\'\);/\'win\',\'width=$1,height=$2,resizable=1,scrollbars=1\'\);/gi" *htm
My command line perl's a bit rubbish as is my regexing, but might be worth a go!

Rob Waite
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top