hi all
i have a problem how to search file which containing number number with file name(tmp_24).
Would be more clear if you post your input and the desired output..however below is just a headsup
grep -w '[0-9]\+' inputfile
My file name is tmp_2.0_20101202_45.I used search command to find this file in particular folder but i can acess only tmp_2.0_20201202 part..not _45.how to read this _45.Iwant to read whole file name.
My code is
var1=`date +"%y%m%d`
find /home/New -name "*${var1}" -exec cp -i {} /root/config/ . \;
You could either change the value of var1 by appending 45 as
var1="$(date +"%y%m%d)_45"
find /home/New -name "*${var1}" -exec cp -i {} /root/config/ . \;
Or without touching the var1, make changes in the find command.
find /home/New -type f -name "*${var1}_45" -exec cp -i {} /root/config/ . \;
Specifying the type of file (type -f) yields you more accurate result.