Not with the 'mv' command itself. But you can run a rename afterwards:
Code:
rename 's/txt\.~(.*)~$/~$1~.txt/i' *
The part in single quotes is a Perl expression; the 's' means substitute, the slashes are separators, the part between the first and second slash is the text to search for, the part between the second and third slash is the replacement, and the trailing 'i' is an option meaning 'case insensitiv'. The "text to search for" is a regular expression; most characters in RE stand for themselves, the exceptions (in this one) are '.' (which stands for one arbitrary character), '\' (takes away any special meaning from the following character, so '\.' means a literal '.' and
not an arbitrary character, '*' (a quantifier meaning as many of the previous character as can be found; '.*' means as many (including 0) arbitrary characters as there are), '$' (meaning 'end of input'), and the parentheses are for grouping sub-expressions and remembering them (so the sub-expression can be used in the replacement; '"$1", "$2", "$3" ... stand for the first, second, third sub-expression in parentheses.
Holger
Bookmarks