grazinggoat
Programmer
I have files that are log.20170321PDT 8 numeric spaces and log.2017032307PDT 10 spaces
the script does a conversion to add seconds to the time stamp to keep them unique
when zipping but for some reason sed adds the extension below
I'm at a loss on where the .2. is being genrated by sed
any thoughts?
echo log.2017032222PDT | sed -e s/\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T$/\.20170322225715PDT/
generates:
log.2.20170322225715PDT
i want the replacement to be log.20170322225715PDT for both 8 or 10 spaced files
if echo ${NAME} | egrep "log.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T" > /dev/null 2>&1 ; then
NewName=$(echo ${NAME} | sed -e s/log\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T$/\.${EXTENSION}/)
else
NewName=$(echo ${NAME} | sed -e s/log\.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/\.${EXTENSION}/)
fi
if echo ${NAME} | egrep "log.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T" > /dev/null 2>&1 ; then
NewName=$(echo ${NAME} | sed -e s/log\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T$/\.${EXTENSION}/)
else
NewName=$(echo ${NAME} | sed -e s/log\.[0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/\.${EXTENSION}/)
the script does a conversion to add seconds to the time stamp to keep them unique
when zipping but for some reason sed adds the extension below
I'm at a loss on where the .2. is being genrated by sed
any thoughts?
echo log.2017032222PDT | sed -e s/\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T$/\.20170322225715PDT/
generates:
log.2.20170322225715PDT
i want the replacement to be log.20170322225715PDT for both 8 or 10 spaced files
if echo ${NAME} | egrep "log.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T" > /dev/null 2>&1 ; then
NewName=$(echo ${NAME} | sed -e s/log\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T$/\.${EXTENSION}/)
else
NewName=$(echo ${NAME} | sed -e s/log\.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/\.${EXTENSION}/)
fi
if echo ${NAME} | egrep "log.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T" > /dev/null 2>&1 ; then
NewName=$(echo ${NAME} | sed -e s/log\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]..T$/\.${EXTENSION}/)
else
NewName=$(echo ${NAME} | sed -e s/log\.[0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/\.${EXTENSION}/)