LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-05-2010, 01:35 AM   #1
wjs1990
Member
 
Registered: Nov 2009
Posts: 30

Rep: Reputation: 15
Grep command


Hi,
For example, what does the command "grep -v ^+: /etc/group" actually means? Thanks.
 
Old 01-05-2010, 02:12 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
grep of course is a command that searches text (either in files or piped in from another command) for matching strings. It can match either straight text or use regular expressions for more flexible searches.

By default grep will give you a whole line that contains a match, but in this instance, -v means invert it; show only lines that don't match.

The second part is the string to match. "^" is a regex character that matches the beginning of a line, so the pattern is any "+:" found at the beginning of a line.

Finally, /etc/group is the name of the file to search.

So, this pattern means, "show every line in /etc/group except those that begin with a "+:".

Do a google search for "grep tutorial". You'll find a load of information.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass the result of a command to another command (like grep) desb01 Programming 4 06-25-2009 12:09 PM
using grep command hiteshthappa Linux - Newbie 4 07-11-2008 08:34 AM
Help me in Grep Command + cd command in single line JeiPrakash Linux - Newbie 3 05-27-2008 04:16 AM
grep command itz2000 Linux - Newbie 2 09-21-2005 07:06 PM
Help With GREP Command juliettree Linux - Newbie 3 04-08-2004 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration