Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- for fname in `ls -1tr /home/kaz/tmp/message*[0-9].gz`
- do
- echo $fname
- #echo $fname | sed -e 's|\(^/.*\)\.\([[:digit:]][[:digit:]]\?\)\.\(gz$\)|\2|g'
- num=`echo $fname | sed -e 's|\(^/.*\)\.\([[:digit:]][[:digit:]]\?\)\.\(gz$\)|\2|g'`
- fname_date=`date --date "${num} day ago" '+%Y%m%d'`
- echo ${fname//$num.gz/$fname_date.gz}
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement