Computing.Net > Forums > Unix > Using Grep

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Using Grep

Reply to Message Icon

Name: H J Calhoun
Date: January 28, 2002 at 20:33:10 Pacific
Comment:

Hello:

I need to use grep to pull a pattern of
information from the /etc/group/ file which
contains four fields and filter this information into a file can someone help
get me started on how to do this.

thank you



Sponsored Link
Ads by Google

Response Number 1
Name: Steve Calvert
Date: January 28, 2002 at 21:47:57 Pacific
Reply:

'cat' the group file and pipe the output through 'grep' with your required pattern as an argument.

e.g. If you are looking for members of the 'adm' group;

$ cat /etc/group | grep 'adm'

Refer to the grep man page for the different switches that allow case sensitivity, reg. exps. etc.


0

Response Number 2
Name: David
Date: February 3, 2002 at 00:05:40 Pacific
Reply:


grep /etc/group > newfile.filtered

that finds all occurances of "pattern" in the file /etc/group and prints those lines into the new file "newfile.filtered"


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


samba problem help



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Using Grep

grep using variables www.computing.net/answers/unix/grep-using-variables/5026.html

using grep -b www.computing.net/answers/unix/using-grep-b-/3195.html

Using the grep command www.computing.net/answers/unix/using-the-grep-command/4811.html