Home > Archive > AWK > September 2006 > Problems W/awk script
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Problems W/awk script
|
|
|
| I've tried running the following script, but keep running into errors:
awk -f: '{if ($2=="") print $1}' /etc/passwd
fi
As you all already know this is supposed to list out any null
passwords, but I keep getting cannot find/locate file named '{$2=="")
print $1}'
Help me please. Thanks.
| |
| Steffen Schuler 2006-09-19, 6:56 pm |
| Shane wrote:
> I've tried running the following script, but keep running into errors:
>
> awk -f: '{if ($2=="") print $1}' /etc/passwd
>
> fi
>
> As you all already know this is supposed to list out any null
> passwords, but I keep getting cannot find/locate file named '{$2=="")
> print $1}'
>
> Help me please. Thanks.
>
use -F: instead of -f:
Regards,
Steffen Schuler
| |
|
| We tried it that way the first time, and we kept getting a 'syntax'
error...
Steffen Schuler wrote:
> Shane wrote:
> use -F: instead of -f:
>
> Regards,
>
> Steffen Schuler
| |
| Ed Morton 2006-09-19, 6:56 pm |
| Steffen Schuler wrote:
> Shane wrote:
>
> use -F: instead of -f:
>
Right, and change the script to:
awk -F: '$2==""{print $1}' /etc/passwd
to be more awk-ish.
Ed.
| |
| Ed Morton 2006-09-19, 6:56 pm |
| Shane wrote:
> We tried it that way the first time, and we kept getting a 'syntax'
> error...
Please don't top-post, and you're probably using old, broken awk. Use
gawk, nawk or /usr/xpg4/bin/awk on SOlaris.
Ed.
> Steffen Schuler wrote:
>
>
>
|
|
|
|
|