Quote:
Originally Posted by
newbie_01
...
Can you tell me what's wrong with it?
[CODE]$: sed 's#\(/db/abcp/DIR/abcp_\)\(_.*\.dbf\)#\(/db/abct/DIR/abct_\)\1#' file > file1
...
There are several errors in your attempt.
- the regex looks for strings with two adjacent
_ in them; there is none in the input.
- parentheses lose their special meaning in the replacement and will be printed as such.
- the leading part of the string seems to be (almost) duplicated by the replacement constant (with the
t char) and the back reference
\1.
- the trailing part is lost as the back reference
\2 is not used.
Try to correct those and come back with the result.