Pages

vendredi 18 novembre 2011

find the length of a string ----csh

To use the csh and awk to find the length of a string, we need:

set leng = `echo $inputstring | awk '{print length($0)}'`

It is the same as

echo $inputstring | awk '{print length($0)}'


Be careful of the quotes ``, '' used in this example.

Aucun commentaire:

Enregistrer un commentaire