hi
i am using ksh in unix. i have set an environmental variable, X, to the following:
[INDENT]
# echo $X
java full version "1.5.0_06-b03"
[/INDENT]
i am trying to do a simple check (using regular expression) in awk to see if X contains "1.5.0". i just need to know yes or no i.e. 0 for yes or >0 for no. i am doing the following:
[INDENT]
# echo $X | awk '$4 ~ /1.5.0/'
java full version "1.5.0_06-b03"
#
[/INDENT]
as you can see, the awk prints the entire sting out if it does contain 1.5.0. if you check for 1.4.2 it does not print anything. in all cases, exit code is 0.
is the another way i can use a regular expression i.e. awk, nawk or sed and just check the exit code for a yes or no answer? not doing this in perl (would prefer to but am not).
--laoisfan