It ain't pretty, but:
echo "/usr/local/backups/db/01.18.05.Tuesday.gz" | sed 's@.*/\([^/]\+/[^/]\+\)@\1@' | sed 's@/@.@'
That turns the full path of the filename into the filename you wanted. Just run it and you'll see
There might be a much more elegant solution using basename
, but I like sed, and the command above works (if a bit cryptic).
Actually, that command will break if the file is stored in the root (/) directory, or a relative directory with only one slash in the path. Just fyi.