replace text with "/" in file

Q

quickcur

Hi, I have a file, in which I have "/home/user/my/good". I would like
to replace all instance to "/opt/somthing". How can I do it with perl?

Thanks,


qq
 
P

Paul Lalli

Hi, I have a file, in which I have "/home/user/my/good". I would like
to replace all instance to "/opt/somthing". How can I do it with perl?

What have you tried so far? How has it failed to work for you?

Read up on regular expressions and the search-and-replace operator at:
perldoc perlretut

You may also be interested in "in-place editing". Search for the -i
option in
perldoc perlrun

Once you've made an attempt, if it doesn't work the way you want, post
a short-but-complete script that demonstrates the problems you're
having.

Paul Lalli
 
T

Tad McClellan

Subject: replace text with "/" in file


If you want to match a literal slash character then you need to either:

escape the slash by putting a backslash character in front of it

or

use a pattern match delimiter that does not appear in your pattern
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,200
Messages
2,571,046
Members
47,646
Latest member
xayaci5906

Latest Threads

Top