grep is superfluous here, by the way.
awk can do its own pattern matching.
Also,
$(..) is highly recommended over `..`
Code:
PI=$( awk -F= '/Suspended/ {print $4}' "$FILE" | awk -F\( '{print $1}' )
You can also reduce it to a single awk instance by using the
split function to divide the desired field into an array instead. Or since we want only the first field, the
sub function would also work (to remove everything from the first paren on).
Code:
PI=$( awk -F= '/Suspended/ { split($4,a,"(") ; print a[1] }' "$FILE" )
PI=$( awk -F= '/Suspended/ { sub(/[(].*/,"",$4) ; print $4 }' "$FILE" )
See here for details on awk's string functions:
http://www.gnu.org/software/gawk/man...Functions.html
Be sure to quote all of your variables too, to prevent possible word-splitting.
http://mywiki.wooledge.org/Arguments
http://mywiki.wooledge.org/WordSplitting
http://mywiki.wooledge.org/Quotes
As a final bit of advice, since environment variables are generally all upper-case, it's good practice to keep your own user variables in lower-case or mixed-case, to help differentiate them.