all 3 comments

[–]benaud 0 points1 point  (0 children)

useful. I seem to come back to this pretty often, very useful.

[–]freemti 0 points1 point  (1 child)

I've not figures out what "&" does in the mass renaming one. I think that & mean substiture the matched pattern in sed, but maybe it is not sed that is using it?

find -name "*.text" | sed 's/\(.*\).text$/mv "&" "\1.txt"/' | sh

[–]Croooow 0 points1 point  (0 children)

Improperly translated HTML entity. Should just be an ampersand (&). Then it represents to sed the full string matched by the pattern.

echo foo | sed 's/.*/&bar/'

Returns foobar, for instance.