Advertisement
kazoda

Untitled

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