Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Character Class ?

Status
Not open for further replies.

polar1

MIS
May 14, 2001
31
US
I am having a problem understanding how the character classes work using Posix. I am trying to extract a single digit from a string as follows:

rowa='1 2 3 4 5'
rowb=`echo $rowa | awk '{print $1,$2,$3,$4,$5}'
for i in "$rowb"
do
if [ "${i+[3[:digit:]} = "3" ] # <- This returns 1
then
echo $i
fi
done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top