Rename command with RegEx pattern can be used to do the bulk rename operation. For example, to append the ip address of the machine in between the log files supplied, the below code is used.
#!/bin/bashThe output will like:
ip=$(hostname -I | sed 's/[^0-9.]*//g')
rename -v "s/(\w+).(\w+)+/\$1$file\$2/" *.log*
shell.log renamed as shell_192.168.1.2.log
shell.log.1 renamed as shell_192.168.1.2.log.1
shell.log.2 renamed as shell_192.168.1.2.log.2
shell.log.zip renamed as shell_192.168.1.2.log.zip