Skip to main content
Welcome guest. | Register | Login | Post

find with -exec

5 replies [Last post]
a thing's picture
Offline
Joined: 2005-12-20
find *.html . -exec mv \{\} $(echo \{\}|sed -e 's/.html/.xhtml/' -) \;
mv: `./19-468.html' and `./19-468.html' are the same file
mv: `./13-468.html' and `./13-468.html' are the same file
...

Why isn't the sed expression running/working?

tbuitenh's picture
Offline
Joined: 2005-12-21
Sed uses regular

Sed uses regular expressions, so .html will match [any character]html . That doesn't answer your question, but could make things go wrong in this way:
book_about_html.html -> book_about.xhtml.html

a thing's picture
Offline
Joined: 2005-12-20
It's not doing that.

But it's not doing that either.

tbuitenh's picture
Offline
Joined: 2005-12-21
Just warning you of the next

Just warning you of the next problem since I have no idea what causes the current one Eye

Offline
Joined: 2006-01-02
instead of escaping, just

instead of escaping, just use single quotes (') and then try debugging it

free-zombie's picture
Offline
Joined: 2006-03-08
the $( ) is most likely

the $( ) is most likely being interpreted by your shell, as I can spot no counter-measure you have taken. Thus, to find, you want mv {} {}.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.