unix ksh: awk

Hello again,

In a two line output file I would need to differentiate between these two cases:

1) only last line has 'every run':
                       ORAUFSHL-MCC02  ABEND 10 08:02  00:01           1 #J27828
 >>every run   ORAUFSHL-MCC02 ABEND 10 08:17  00:01           1 #J7609; &0:15

2) both lines have 'every run':
 >>every run   ORAUFSHL-MCC01  ABEND 10 08:02  00:01           1 #J27828
 >>every run   ORAUFSHL-MCC02 ABEND 10 08:17  00:01           1 #J7609; &0:15

So the command would read the file and
 if 1) => action1
 if 2) => action2


WatnogAsked:
Who is Participating?
 
point_pleasantCommented:
usage prog_name file_name


count=`grep ">>every run" $1 | wc -l`
if [ "$count" == 1 ]
then
        echo "Action 1"
elif [ "$count" == 2 ]
then
        echo "Action 2"
else
        echo "Error"
fi
0
 
collins23Commented:
grep -o "every run" file1| wc -l
0
 
collins23Commented:
assuming file name is file1 ... the result shall either be 1 or 2
0
 
WatnogAuthor Commented:
Thanks both of you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.