I'm not sure why this has been migrated from StackOverflow, as the question is as unclear here as it is there.
It looks like you are trying to get a list of PIDs of all running processes matching "dspload -d 1 -e" but excluding awk (which you are using to filter the output of ps and just grab the first column.
It also looks like your command, ps | awk '/dspload -d 1 -e/&&!/awk/{print $1}' is working from the command-line. On whichever operating system you are running, within whichever shell you are running. I suspect that the output looks something like:
23875
23874
1368
23873
I gather that rather than try to remember this complicated command-line, you have put it into some kind of file and are trying to run it as a shell-script but this is not working. I have no idea what this shell script looks like.
I can tell you that if your shell script looks like this:
#!/bin/sh
ps | awk '/dspload -d 1 -e/&&!/awk/{print $1}'
Then running it will give you the same output as running the command at a bash prompt on Mac OS X.
If you have you have extracted the process to a variable, you'll need to ensure that this is is expanded within the call to awk, viz:
#!/bin/sh
process="dspload -d 1 -e"
ps | awk '/'${process}'/&&!/awk/{print $1}'
Using single quotes (') will mean that $1, which has a special meaning within the Bourne Shell, will not be expanded (but will be interpreted by awk.
Any decent editor will highlight the syntax for you and help you to spot any errors.