Link to home
Start Free TrialLog in
Avatar of ittechlab
ittechlabFlag for Canada

asked on

sed - script

I am trying to understand these line. Can some one explain as i am new to scripting.


egrep 'PASS|FAIL' $LOGFILE | wc -l | sed 's/^ *//;s/ *$//'

grep PASS $LOGFILE | wc -l | sed 's/^ *//;s/ *$//'

grep FAIL $LOGFILE | wc -l | sed 's/^ *//;s/ *$//'

echo $SCAN_PASS/$SCAN_TOTAL*100 | bc -l | awk -F. '{print $1}'| sed 's/^ *//;s/ *$//'
Avatar of ittechlab
ittechlab
Flag of Canada image

ASKER

what is this mean?

sed 's/^ *//;s/ *$//'
Avatar of woolmilkporc
This removes empty lines as well as lines containing only spaces.
SOLUTION
Avatar of simon3270
simon3270
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks


$SCAN_PASS=10
$SCAN_TOTAL=20

can you please advise what is this line does. do we need bc -l?

$SCAN_PASS/$SCAN_TOTAL*100 | bc -l | awk -F. '{print $1}'| sed 's/^ *//;s/ *$//'
sorry.

SCAN_PASS=10
SCAN_TOTAL=20

not

$SCAN_PASS=10
$SCAN_TOTAL=20
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial