Afficher un message
Vieux 25/08/2006, 08h52   #1
mats.karstad@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Formatting grep result.

Hi,

I am pretty new to shell scripting so this problem might be trivial,
but I can't for the life of me figure it out or find any resources
online that does what I want.

Basically I am grepping from a large log file as I am only interested
in certain entries.

The code I am using is the following:

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) 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.


Best Regards
Mats Karstad

  Réponse avec citation
 
Page generated in 0,06466 seconds with 9 queries