5
To locate files whose name contains a particular string, we can resort to find
as follows:
File example:
1429331804.H568641P9577.xxxx.example.com,S=17846:2,
Command to locate by xxxx.example.com
:
find . -type f -name "*xxxx.example.com*"
And this will return only the files that contain the string nominee.
Question
How to rename returned files by replacing the key portion to another value?
1429331804.H568641P9577.xxxx.example.com,S=17846:2,
Passes to:
1429331804.H568641P9577.yyyy.superbubu.pt,S=17846:2,
If you are writing a bash script you can put the name of the files in a variable and then use
sed
to change the filename using regular expressions. And then vc usesmv fich_orig fich_dest
.– GabrielOshiro
It is possible to use the
find
with the optionexec
, which runs a command with each result returned byfind
. See http://rberaldo.com.br/find-como-encontrararquivos-linux/– Beraldo