ahSher
1
Hi all.
I have a script as below:
cutmth=`TZ=CST+2160 date +%b`
export cutmth
echo $cutmth >> date.log
sed -n "/$cutmth/$p" alert_sbdev1.log > alert_summ.log
My purpose is to run through the alert_sbdev1.log and find the 1st occurence of 'Jan' and send everything after that line to alert_summ.log.
When I execute my script, i get this error:
sed: 0602-403 /Jan/ is not a recognized function.
What is wrong with my script? Please help. Thanks.
Place a comma after the last slash:
sed -n "/$cutmth/,$p" alert_sbdev1.log > alert_summ.log
Regards
ahSher
3
Hi,
I amended my script to below, but still got error.
cutmth=`TZ=CST+2160 date +%b`
export cutmth
echo $cutmth >> date.log
sed -n "/$cutmth/,$p" alert_sbdev1.log > alert_summ.log
Error:
sed: 0602-404 Function /Jan/, cannot be parsed.
Thanks.
try this
cutmth=`TZ=CST+2160 date +%b`
export cutmth
echo $cutmth >> date.log
sed -n /$cutmth'/,$p' alert_sbdev1.log > alert_summ.log
ahSher
5
Hi vidyadhar85,
Thanks! Got it working! =)