Simple script to rename log files with their last modified date.
Sample: rename_log.sh

Technical notes, and other ideas.
Simple script to rename log files with their last modified date.
Sample: rename_log.sh
Refer: https://www.cyberciti.biz/faq/bash-for-loop/
for i in `find . -name '*.xml'`
do
echo $i
done
This type of for loop is characterized by counting. The range is specified by a beginning (#1) and ending number (#5). The for loop executes a sequence of commands for each member in a list of items. A representative example in BASH is as follows to display welcome message 5 times with for loop:
#!/bin/bash
for i in 1 2 3 4 5
do
echo "Welcome $i times"
done
Sometimes you may need to set a step value (allowing one to count by two’s or to count backwards for instance). Latest bash version 3.0+ has inbuilt support for setting up ranges:
#!/bin/bash
for i in {1..5}
do
echo "Welcome $i times"
done
Bash v4.0+ has inbuilt support for setting up a step value using {START..END..INCREMENT} syntax:
#!/bin/bash
echo "Bash version ${BASH_VERSION}..."
for i in {0..10..2}
do
echo "Welcome $i times"
done
In UNIX/Linux, you can use grep and wc to count occurrences
cat mystuff.txt | grep -i "search" | wc -l