0

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.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by gerard4143
0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.