From: Vance_Brasher@dril-quip.com
Date: Wed Sep 25 2002 - 16:33:23 EDT
Thanks to the following people.
Kevin Nikiforuk, George Bodnar, James Sohr, Steen Hammerum.
You can do any of the following.
echo "$TST" | awk -F'/' '{print NF}'
echo $TST | sed 's/\// /g' | wc -w
echo "$tst" | tr -c -d "/" | wc -c
Regards,
Vance Brasher
Unix System Administrator
Dril-Quip, Inc
-----Original Message-----
From: Vance_Brasher@dril-quip.com [mailto:Vance_Brasher@dril-quip.com]
Sent: Wednesday, September 25, 2002 3:16 PM
To: hpux-admin@dutchworks.nl
Subject: [HPADM] Scripting (counting number of times something shows up in a
var)
Guys, can anyone think of a way in a korn shell to do the following.
I have a variable called TST.
TST="/test/test/test"
I need to be able to return the number of / marks in it. Any ideas on a
quick/easy way to do this?
Regards,
Vance.
-- ---> Please post QUESTIONS and SUMMARIES only!! <--- To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl Name: hpux-admin@dutchworks.nl Owner: owner-hpux-admin@dutchworks.nl Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only) http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search) -- ---> Please post QUESTIONS and SUMMARIES only!! <--- To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl Name: hpux-admin@dutchworks.nl Owner: owner-hpux-admin@dutchworks.nl Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only) http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search)
This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:20 EDT