csh
does not have string functions. UNIX traditionally uses small and simple programs. Selecting data (columns or words) can be done using (for example) sed
, awk
or cut
. In this case one solution using cut
would be:
% set a = "hello 911 is not 91 only"
% echo $a
hello 911 is not 91 only
% echo $a | cut -c 7-9
911
% echo $a | cut -c 18-19
91
Note that your columns are off a bit, 911 is indeed at the 7th to 9th characters.
Or if you want to have the result in a variable:
% set a = "hello 911 is not 91 only"
% set b = `echo $a | cut -c 7-9`
% set c = `echo $a | cut -c 18-19`
% echo "I found $b and $c"
I found 911 and 91