How to compare it ??

Hi how do you compare it in ksh

ALINES=$(cat AFILE | wc -l)
BFIRST=$(head -1 BFILE)

I got ALINES=9 and BFRIST=records'9'

I want 9=9 , how do you write BLINES=9 from records'9' so I can say
ALINES==BLINES

Thanks

If the number always comes in single quotes ' then....try this

ALINES=$(cat AFILE | wc -l)
BFIRST=$(head -1 BFILE)
BFIRST_NUMBER=`awk -F"'" '{ print $2 }' BFRIST`
then BFIRST_NUMBER will have 9

It is not working

+ + wc -l
+ cat A
ALINES= 9
+ + head -1 B
BFIRST=records='9'
+ + awk -F' { print $2 } BFIRST
awk: 0602-533 Cannot find or open file BFIRST.
The source line number is 1.
BLINES=
+ print BLINES
BLINES
+ (( ALINES == BLINES ))
t3[7]: ALINES == BLINES : 0403-009 The specified number is not valid for this command.

BFIRST is not a FILE :slight_smile:

ALINES=$(cat AFILE | wc -l)
BFIRST=$(head -1 BFILE)
BFIRST=`echo $BFRIST | cut -d "'" -f 2`
then BFIRST_NUMBER will have 9

My mistake!
The last line in the last reply was wrong.

ALINES=$(cat AFILE | wc -l)
BFIRST=$(head -1 BFILE)
BFIRST=`echo $BFRIST | cut -d "'" -f 2`
then BFIRST will have 9