Afficher un message
Vieux 25/08/2006, 10h17   #4
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Formatting grep result.

On 25 Aug 2006 00:52:22 -0700, mats.karstad@gmail.com
<mats.karstad@gmail.com> wrote:
>
> MAILBODY=`grep -n "XX" ${LOGFILE}`
> SUBJECT="Logg informasjon"
>
> if [ "$MAILBODY" != '' ] ; then
>
> echo $MAILBODY | ${MAILPROGRAM} -s "${SUBJECT}" ${MOTTAKER}
> fi
>
> Just basically grepping the line with token XX then if data was found i
> send this via email.
>
> My problem is first of all, I do not want the token to be printed (not
> critical)

MAILBODY=`grep -n "XX" ${LOGFILE} | sed 's/XX//g'`
MAILBODY=`awk '/XX/{gsub(/XX/,"")rint NR ":" $0}'`

> secondly and most importantly I want each entry to be printed
> on separate lines as in adding a line break at the end of each result,
> because as it is it just tags all the lines after each other making it
> hopeless to use.
>

echo "$MAILBODY"



--
Microbiology Lab: Staph Only!
  Réponse avec citation
 
Page generated in 0,04645 seconds with 9 queries