Ignore commented lines and lines which as "/"

Hi all,

I have a file like file1.txt
contents in file1.txt

#paths
/opt/new/sample1.sh
/var/opt/new1/sample2.sh
/
#

here ,
i need to omit the lines which is commented and the line which the root directory"/" alone is specified

i will assign the file to a variable ex. PATH
so when i echo $PATH
I should get the output as
/opt/new/sample1.sh /var/opt/new1/sample2.sh

please provide me as solution.

Regards,
NG

Hi,
you could try this:

PATH=$(awk '/opt/,/var/ {print}' file1.txt )

Bye

It is better if you don't use PATH as your variable:D
I forgot to tell you this
it's better using another name because PATH is used as an environment variable
Bye

mypath=$(egrep -v '^(#|\/$)' file1.txt)

ksh -
omits any lines beginning with # or lines containing ONLY /