Personal tools
You are here: Home Wiki POWCamp
Views

Edit history

Edit: -1 of 1
Time: 2006-09-18 17:41:36
Note: /kplug_main/wiki/LinuxAnswers/upgradeAll

changed:
-
Perls of Wisdom Camp

  Here is a place to share some of your tricks and tips about perl.

 Q: I need to change same pattern in a lot of files. I need to change this pattern:  *!https://web* to *../../..*

A: perl makes this drop dead easy::

perl -pi -e's(!https://web)(../../..)g' *.html

-p:*p*rint each line

-i:perform an *i*nplace edit

-e:*e*xecute the following argument as the command/script

s/target/replacement/flags:*s*earch and replace

!https//web:the target string *(ed: yes i am aware of the lack of a colon. wiki limitation, forgive me)*
../../..:the replacement string

g:*g*lobal replacement, find each occurence on the line.

-john 2003-01-25T01:39:33-0800


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: