i am using the c shell on solaris.
directories i'm working with:
ls -1d DIV*
DIV_dental/
DIV_ibc/
DIV_ifc/
DIV_index/
DIV_pharm/
DIV_sectionI/
DIV_sectionI-title/
DIV_sectionI-toc/
DIV_sectionII-title/
DIV_sectionII-toc/
DIV_standing/
DIV_standing-toc/
DIV_title/
DIV_vision/
what i am attempting to do is capture only the directories containing "dental", "vision", or "pharm".
at the command line i can do this via
ls -1d DIV* | egrep 'dental|pharm|vision'
or
ls -1d DIV* | nawk '/dental|vision|pharm/{print $1}'
and so on...
however, in my shell script this does not work (the $grp and $job variables i am using for a path are legit):
foreach div (`ls -1d ${grp}/${job}/DIV* | egrep 'pharm|dental|vision'`)
printf "\t%s..." ${div:t}
end
this gives me ALL directories. if i cut it back to
egrep 'pharm|dental' i get only the pharm and dental directories
i have also tried using awk and nawk in the script, with the same results. my coworker has advised me to try something with find, which i will, but i am curious to why this is happening.
thanks for your assistance.