# Linux “rpl” command doesn’t replace text

find and replacegreplinux

I'm using rpl program in linux to replace date( with pdate( in some files.
But it says A Total of 0 matches replaced in 1 file searched.
while grep output for date( is:

ariyan@ariyan-laptop:/var/www/moodle21$grep -wR 'date(' admin/uploaduser.php$today = make_timestamp(date('Y', $today), date('m',$today), date('d', \$today), 0, 0, 0);


I'm using rpl as this:

rpl -wR 'date(' 'pdate(' admin/uploaduser.php


What is the problem?

I've never used this tool before, but looking at the description of what "-w" I am guessing that it is handling word boundaries slightly different than expected. If you take the "-w" off, it should work. Additionally, in the example you've given it a single file to match against, so the -R isn't going to come into play either.

Try:

rpl 'date(' 'pdate(' admin/uploaduser.php


EDIT: After a bit of researching, I found that there is a bug reported for rpl not handling punctuation as word boundaries, which is why this isn't working. So the only option is to use another tool. Sed comes to mind for this task, so you can accomplish it with the following:

sed -i 's/\bdate(/pdate(/g' admin/uploaduser.php


That will do an inline replace (-i) the same way rpl would have done it and is matching for things that start date and replacing them with pdate.