I need help with a script to find only users that starts with a alpha character followed by 4 digits (ie. a9999).
Here's what I did so far (not working):
#!/usr/bin/ksh
cat /etc/passwd | awk -F: '{print $1}' |
while [[ $MORE -ge 1 ]]
do
read USER
if [ len(USER) == 5 ]
then
if [substr(USER) == "[a-z][0-9][0-9][0-9][0-9]"]
echo " * found : $USER"
fi
fi
done
Here's what I did so far (not working):
#!/usr/bin/ksh
cat /etc/passwd | awk -F: '{print $1}' |
while [[ $MORE -ge 1 ]]
do
read USER
if [ len(USER) == 5 ]
then
if [substr(USER) == "[a-z][0-9][0-9][0-9][0-9]"]
echo " * found : $USER"
fi
fi
done