Dec 6, 2002 #1 Tison Programmer May 12, 1999 216 CH I have the following strings and I need to count the number of .s JOBNAME_123.1.3 JOBNAME_234.1 JOBNAME_345 My result should be ; 2 1 0 I tried grep -c "\." but only get 1.
I have the following strings and I need to count the number of .s JOBNAME_123.1.3 JOBNAME_234.1 JOBNAME_345 My result should be ; 2 1 0 I tried grep -c "\." but only get 1.
Dec 6, 2002 #2 KenCunningham Technical User Mar 20, 2001 8,475 GB Sorry, this isn't an answer, but grep -c counts the lines with the string, rather than occurences of the string. Cheers. Upvote 0 Downvote
Sorry, this isn't an answer, but grep -c counts the lines with the string, rather than occurences of the string. Cheers.
Dec 6, 2002 1 #3 Boria Programmer Oct 16, 2002 156 RU Hi Tison, in ksh script you can do A=JOBNAME_123.1.3 B=`echo $A|tr -d "."` ((DotNumb=${#A}-${#B})) Regards Boris Upvote 0 Downvote
Hi Tison, in ksh script you can do A=JOBNAME_123.1.3 B=`echo $A|tr -d "."` ((DotNumb=${#A}-${#B})) Regards Boris
Dec 6, 2002 Thread starter #4 Tison Programmer May 12, 1999 216 CH When I run the script I get ; ./getln[3]: DotNumb=JOBNAME_123.1.3-JOBNAME_12313: 0403-009 The specified number is not valid for this command Upvote 0 Downvote
When I run the script I get ; ./getln[3]: DotNumb=JOBNAME_123.1.3-JOBNAME_12313: 0403-009 The specified number is not valid for this command
Dec 6, 2002 #5 Boria Programmer Oct 16, 2002 156 RU Hi Tison, check you don't forgot # in line 3. ${#A}-${#B} not ${A}-${B} Boris Upvote 0 Downvote
Dec 6, 2002 Thread starter #6 Tison Programmer May 12, 1999 216 CH Yes,,,thank you.It works now. Upvote 0 Downvote