---to test if str exists in $mystring:
echo $mystring | awk '{print index($0, "str")}'" searches the $mystring variable for an occurrence of "str" in the string's value.
if exists, return 1, otherwise 0
--- to get the last few letters from a string:
awk '{ print substr( $0, length($0) - 1, length($0) ) }' input_file
Aucun commentaire:
Enregistrer un commentaire