Script using awk works only as super user

hi friends,

I am a new Sun Solaris 10 user. I have the following script

line=$(awk '{if(substr($0,1,1)!="#" &&
substr($0,1,1)!=";" &&
substr($0,1,1)!=" " &&
substr($0,1,1)!="/" &&
substr($0,1,1)!="*" &&
substr($0,1,1)!="\\" &&
length($0)!=0)
{print $0}
}' filename

This works fine when i login as super user but it does not work with other user and show error.

Do i need to change any enviornment variables please help

Thanks
Jithin.G

I'm guessing there is an alias awk=nawk. Solaris awk is, um, defective, so advanced features require nawk - the new awk. As superuser, try

type awk

, then see what you get as another user from the same command.

In general you do not want to run around the system doing things in privileged mode. It's to easy to do something horrendous

Thak you i will try and look into it

I am still geting the error

....ksh[line]: awk: not found

but with superuser it stll working

Login as superuser:- 
type awk

then login as other user and add awk path to PATH variable in .profile and relogin

$PATH in super user has another component /usr/sbin
But which awk in both super user and user gives /usr/bin
I tried to change $PATH in *.profile file of user .it changes in file . But then again i checked the echo $PATH it shows the same earlier result.

The env command also shows earlier $PATH

after changing $PATH in .profile you need to relogin

i restarted the system but it shows the same.....
The file content is changed But echo $PATH does not show any change
I changed the .profile file in /home/user/.profile file . Is this correct.

try like this

~/.profile

is shows permission denied.

put following entry in ur script

export PATH=${PATH}:/usr/sbin/