Hello,I just started learning grep at school and I can't figure out why my syntax is incorrect.I have to solve the following problem using grep:
Find all the computer science students in the first three years of
study, belonging to odd numbered groups. The usernames of the
computer science students have either "ie" or "ir" as their third
and fourth letters.

The grep syntax I thought would resolve this problem is the following , but it doesn't return anything:

grep "/gr[0-9][1-3][13579]"/etc/passwd | grep "^..i[er]'username' "/etc/passwd

where passwd contains the needed information, and the group number is formed of 3 digits.

Some advice would be greatly appreciated.

Hello,I just started learning grep at school and I can't figure out why my syntax is incorrect.I have to solve the following problem using grep:
Find all the computer science students in the first three years of
study, belonging to odd numbered groups. The usernames of the
computer science students have either "ie" or "ir" as their third
and fourth letters.

The grep syntax I thought would resolve this problem is the following , but it doesn't return anything:

grep "/gr[0-9][1-3][13579]"/etc/passwd | grep "^..i[er]'username' "/etc/passwd

where passwd contains the needed information, and the group number is formed of 3 digits.

Some advice would be greatly appreciated.

Your also having difficulties with sections...this should be posted in shell scripting

This article has been dead for over six months. Start a new discussion instead.