I'm trying to change the date in the first line of a text file by using Sed to replace the previous days date with the current days date.
Below is the code from the bash script that I'm trying to use to accomplish this:
YMD=$(date +%Y%m%d)
ODA=$(date -u +%Y%m%d --date="1 days ago")
mv ${HOMEDIR}/${PATH1}/nws_${VAR}_conus_daily_${ODA}.ctl ${HOMEDIR}/${PATH1}/nws_${VAR}_conus_daily_${YMD}.ctl
sed "s/${ODA}/${YMD}/" ${HOMEDIR}/${PATH1}/nws_${VAR}_conus_daily_${YMD}.ctl
URL1=http://water.weather.gov/${VAR}/p_download_new/${Y}/${M}/${D}/nws_${VAR}_conus_${YMD}.nc
wget -P ${HOMEDIR}/${PATH1}/ -N ${URL1}
The first line in the text file reads as follows:
dset ^grads/data/ahps/nws_precip_conus_20140423.nc
cat -vte file.txt?