hi,
i am trying to use sed to replace a single space in a date variable with a double space and then use that value to find all entries in a log file:
num_day="8"
C_HOUR="13"
C_DATE='Wed Dec 8'
C_DATE="`echo $C_DATE | /bin/sed -e 's/'${num_day}'/ '${num_day}'/'`"
# replaces day number with double spaces i.e.Wed Dec 8 with # Wed Dec 8
# write all lines beginning from ${C_DATE} in
# alert_TEST.log to errors.dat file
sed -n "/^${C_DATE} $C_HOUR.*1999/,$ p" alert_TEST.log > errors.dat
the variable C_DATE used outside of " " removes multiple spaces.
any help would be very much appreciated.
thanks.
ed.
i am trying to use sed to replace a single space in a date variable with a double space and then use that value to find all entries in a log file:
num_day="8"
C_HOUR="13"
C_DATE='Wed Dec 8'
C_DATE="`echo $C_DATE | /bin/sed -e 's/'${num_day}'/ '${num_day}'/'`"
# replaces day number with double spaces i.e.Wed Dec 8 with # Wed Dec 8
# write all lines beginning from ${C_DATE} in
# alert_TEST.log to errors.dat file
sed -n "/^${C_DATE} $C_HOUR.*1999/,$ p" alert_TEST.log > errors.dat
the variable C_DATE used outside of " " removes multiple spaces.
any help would be very much appreciated.
thanks.
ed.