This is the
talk page for discussing improvements to the
Grep article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google ( books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
![]() | This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||
|
The recently added section about ms-dos find dosn't belong to this page IMHO. If no one complains I will remove it. Lost Goblin 02:18, 14 May 2005 (UTC)
'grep -r foo .' seems more appropriate than 'grep -r foo *'. The former is literally recursively searching the current directory, while the latter is only searching the non-hidden files and directories in the current directory, and their (hidden or non-hidden) subdirectories/files. (meaning it's inconsistent, only ignoring hidden stuff in the current directory, but showing all other hidden stuff below it) —Preceding unsigned comment added by 216.99.35.21 ( talk • contribs) 03:10, 7 June 2005
Although I'm not asking to make this Wikipedia article into a man page, a few more examples of how to use grep would be nice. Partly because less technical users have trouble understanding man pages, and therefore they could benefit from explanation here. —Preceding unsigned comment added by 216.99.35.21 ( talk • contribs) 03:10, 7 June 2005
according to Jeffrey Friedl's Mastering Regular Expressions 2nd Ed (O'Reilly 2002) grep stands simply for global regular expression print.
—Preceding unsigned comment added by 80.108.115.184 ( talk • contribs) 01:13, 13 October 2005
So I'm going to cancel the "goto" recently placed:
JackPotte ( talk) 14:45, 24 April 2010 (UTC)
I agree with the comment on the history page requesting citation: if "grep" is ever used with the meaning of "grok", it is simply an error by the ignorant. I don't think that this is an established usage. I think that this claim should be deleted unless someone can provide evidence that there is a community in which this usage is normal. -- Bill 20:50, 11 May 2006 (UTC)
When I first came across grep on a Prime Minicomputer in 1986 it was noted as General-Purpose Random Expresion Parser. It was in an American published user guide. I may still have a copy of it somewhere and will try to check it out. —Preceding unsigned comment added by 193.113.57.167 ( talk • contribs) 2006-09-16 01:59:42
g/re/p
and not any of the other anecdotal sources. Many companies and people may have ascribed
backronyms, but we need to be very clear about the original source of the name, and how it was meant to expand. -
Harmil 15:33, 24 July 2007 (UTC)For a complete description of the regular expression, see ed (I). Care should be taken when using ...
Early sources show nothing about "parser", only "print". From Version 6 UNIX manual page for the ed editor, http://man.cat-v.org/unix-6th/1/ed, we see that the g command is "global":
(1,$)g/regular expression/command list In the global command, the first step is to mark every line which matches the given regular expression. Then for every such line, the given command list is executed with `.' initially set to that line. A single command or the first of multiple commands appears on the same line with the global command. ...
Also regular expression is clearly there too.
For the command list suffix, we are using a single p command . The p command is documented as print
( . , . )p The print command prints the addressed lines. `.' is left at the last line printed. The p command may be placed on the same line after any command.
And just to be more complete, lets look back to the V4 UNIX manual page for grep from March 3rd, 1973 http://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man1/grep.1 . Here, if we search for SPACE and p, (" p"), we find 7 occurrences: the first is "pattern", which refers to the regular express. The remaining six are the word "printed". No mention is made for "parser".
So let's go to the source code: ftp://ftp.math.utah.edu/pub//mirrors/minnie.tuhs.org/PDP-11/Distributions/research/Dennis_v6/ and the GZIP'd TAR archive : ftp://ftp.math.utah.edu/pub//mirrors/minnie.tuhs.org/PDP-11/Distributions/research/Dennis_v6/v6src.tar.gz and down in the s1 (for Section 1) subdirectory, we find grep.c in refreshingly old C :-) . The sole comment in the program is right in the first lines of the file and is:
# /* * grep -- print lines matching (or not matching) a pattern * */ #define CCHR 2 #define CDOT 4
Nowhere in the file is the word parse mentioned :-) (and I can't pass without showing the ancient C =+ rather than += )
case CCL: if (cclass(ep, *lp++, 1)) { ep =+ *ep; continue; } return(0);
So ultimately, the original meaning from 1973 should trump some technical writer at Prime in 1986 backronyming the name.
-- Lent ( talk) 17:47, 28 September 2012 (UTC)
I've removed the link to GNU grep from the extlinks section again. The article already contains a link to " Tony Abou-Assaleh's list of Greps" (unfortunately sub-titled "Global Regular Expression Print Tools"), which links to various different greps. We needn't include an additional link just for GNU grep. Chris Cunningham (not at work) - talk 10:12, 22 July 2008 (UTC)
I believe this article
http://www.columbia.edu/~rh120/ch001j.c11
About the origin should be referenced in the references and maybe in the ariticle itself.
What do others think?
Hogan ( talk) 15:31, 4 February 2009 (UTC)
Just take a look, You Can't Grep Dead Trees. It's currently the fourth reference to this article. I left it intact as I'm not sure whether the link to a casual blog post is proper or not. Protez ( talk) 15:56, 16 October 2009 (UTC)
Does it need one? —Preceding unsigned comment added by 65.196.214.163 ( talk) 14:41, 20 October 2009 (UTC)
The date in the man page for Unix 4 does not necessarily mean the creation date. I emailed Ken Thompson himself who clarified it was his private command for quite a while. 208.15.90.2 ( talk) 17:12, 14 January 2014 (UTC)
This goes into the early history of many UNIX commands, including grep, sed, and others. It would be good to include some on Wikipedia: http://www.columbia.edu/~rh120/ch106.x09 Family Guy Guy ( talk) 13:19, 27 August 2023 (UTC)
I'm removing the following example, under the assumption that confusing help is worse than no help at all:
grep -w apple fruitlist.txt | grep -w ^apple$
1. If you're going to do "grep -w ^apple$" there's no point in the preceding command. Or the -w for that matter. 2. The "$" suffix hasn't been explained yet.
If anyone cares to improve this and reinstate it that would be fine with me. 68.110.104.80 ( talk) 02:14, 10 February 2010 (UTC)
I am not sure that not no. 5
^ Zaid Alawi. ""You Can't Grep Dead Trees"". Retrieved 2009-06-09.
is relevant here, I think it should be omitted?? —Preceding unsigned comment added by 76.19.135.92 ( talk) 14:14, 13 July 2010 (UTC)
i believed that the article needed how to ignore a search term as well. it just made sense. Foxwolfblood ( talk) 02:10, 7 November 2010 (UTC)
This would be a lot easier to understand if the article explained the syntax of the command. How do you set the target/scope of a grep search? Stub Mandrel ( talk) 07:02, 27 August 2018 (UTC)
Cyberbot II has detected links on Grep which have been added to the blacklist, either globally or locally. Links tend to be blacklisted because they have a history of being spammed or are highly inappropriate for Wikipedia. The addition will be logged at one of these locations: local or global If you believe the specific link should be exempt from the blacklist, you may request that it is white-listed. Alternatively, you may request that the link is removed from or altered on the blacklist locally or globally. When requesting whitelisting, be sure to supply the link to be whitelisted and wrap the link in nowiki tags. Please do not remove the tag until the issue is resolved. You may set the invisible parameter to "true" whilst requests to white-list are being processed. Should you require any help with this process, please ask at the help desk.
Below is a list of links that were found on the main page:
\bgrepmaster\.eu
on the global blacklistIf you would like me to provide more information on the talk page, contact User:Cyberpower678 and ask him to program me with more info.
From your friendly hard working bot.— cyberbot II NotifyOnline 03:26, 17 October 2014 (UTC)
This contradicts what is currently in the History section of the article, but take a look at Brian Kernighan and Ken Thompson. A nerdy delight for any Vintage Computer Fest 2019 attendee: Kernighan interviewing Thompson about Unix. YouTube. Event occurs at 35m40s to 38m32s. Retrieved September 3, 2019. It seems as if this should be covered in the article. Wtmitchell Wtmitchell (talk) (earlier Boracay Bill) 16:00, 3 September 2019 (UTC)
A lot of search tools fail to find certain file formats, or ignore hits after a certain point in the file, or fail to find non-Roman text in certain file formats. So a list of what formats grep can find would be relevant and useful. 108.51.205.136 ( talk) 19:49, 21 December 2019 (UTC)
In the most recent Computerphile video on YouTube, titled "Coffee with Brian Kernighan", at the very end, Brailsford asks "Who wrote grep?" and Kernighan points at himself, saying "I did".
I always thought Thompson wrote it, but Kernighan really isn't the type to take accomplishments from Thompson, he always shows massive admiration for Thompson. So I am a bit confused. Kernighan saying he wrote it, is as much as a first-hand source as we ever get to. How to proceed?-- 91.64.59.136 ( talk) 13:16, 28 August 2022 (UTC)
This is the
talk page for discussing improvements to the
Grep article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google ( books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
![]() | This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||
|
The recently added section about ms-dos find dosn't belong to this page IMHO. If no one complains I will remove it. Lost Goblin 02:18, 14 May 2005 (UTC)
'grep -r foo .' seems more appropriate than 'grep -r foo *'. The former is literally recursively searching the current directory, while the latter is only searching the non-hidden files and directories in the current directory, and their (hidden or non-hidden) subdirectories/files. (meaning it's inconsistent, only ignoring hidden stuff in the current directory, but showing all other hidden stuff below it) —Preceding unsigned comment added by 216.99.35.21 ( talk • contribs) 03:10, 7 June 2005
Although I'm not asking to make this Wikipedia article into a man page, a few more examples of how to use grep would be nice. Partly because less technical users have trouble understanding man pages, and therefore they could benefit from explanation here. —Preceding unsigned comment added by 216.99.35.21 ( talk • contribs) 03:10, 7 June 2005
according to Jeffrey Friedl's Mastering Regular Expressions 2nd Ed (O'Reilly 2002) grep stands simply for global regular expression print.
—Preceding unsigned comment added by 80.108.115.184 ( talk • contribs) 01:13, 13 October 2005
So I'm going to cancel the "goto" recently placed:
JackPotte ( talk) 14:45, 24 April 2010 (UTC)
I agree with the comment on the history page requesting citation: if "grep" is ever used with the meaning of "grok", it is simply an error by the ignorant. I don't think that this is an established usage. I think that this claim should be deleted unless someone can provide evidence that there is a community in which this usage is normal. -- Bill 20:50, 11 May 2006 (UTC)
When I first came across grep on a Prime Minicomputer in 1986 it was noted as General-Purpose Random Expresion Parser. It was in an American published user guide. I may still have a copy of it somewhere and will try to check it out. —Preceding unsigned comment added by 193.113.57.167 ( talk • contribs) 2006-09-16 01:59:42
g/re/p
and not any of the other anecdotal sources. Many companies and people may have ascribed
backronyms, but we need to be very clear about the original source of the name, and how it was meant to expand. -
Harmil 15:33, 24 July 2007 (UTC)For a complete description of the regular expression, see ed (I). Care should be taken when using ...
Early sources show nothing about "parser", only "print". From Version 6 UNIX manual page for the ed editor, http://man.cat-v.org/unix-6th/1/ed, we see that the g command is "global":
(1,$)g/regular expression/command list In the global command, the first step is to mark every line which matches the given regular expression. Then for every such line, the given command list is executed with `.' initially set to that line. A single command or the first of multiple commands appears on the same line with the global command. ...
Also regular expression is clearly there too.
For the command list suffix, we are using a single p command . The p command is documented as print
( . , . )p The print command prints the addressed lines. `.' is left at the last line printed. The p command may be placed on the same line after any command.
And just to be more complete, lets look back to the V4 UNIX manual page for grep from March 3rd, 1973 http://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man1/grep.1 . Here, if we search for SPACE and p, (" p"), we find 7 occurrences: the first is "pattern", which refers to the regular express. The remaining six are the word "printed". No mention is made for "parser".
So let's go to the source code: ftp://ftp.math.utah.edu/pub//mirrors/minnie.tuhs.org/PDP-11/Distributions/research/Dennis_v6/ and the GZIP'd TAR archive : ftp://ftp.math.utah.edu/pub//mirrors/minnie.tuhs.org/PDP-11/Distributions/research/Dennis_v6/v6src.tar.gz and down in the s1 (for Section 1) subdirectory, we find grep.c in refreshingly old C :-) . The sole comment in the program is right in the first lines of the file and is:
# /* * grep -- print lines matching (or not matching) a pattern * */ #define CCHR 2 #define CDOT 4
Nowhere in the file is the word parse mentioned :-) (and I can't pass without showing the ancient C =+ rather than += )
case CCL: if (cclass(ep, *lp++, 1)) { ep =+ *ep; continue; } return(0);
So ultimately, the original meaning from 1973 should trump some technical writer at Prime in 1986 backronyming the name.
-- Lent ( talk) 17:47, 28 September 2012 (UTC)
I've removed the link to GNU grep from the extlinks section again. The article already contains a link to " Tony Abou-Assaleh's list of Greps" (unfortunately sub-titled "Global Regular Expression Print Tools"), which links to various different greps. We needn't include an additional link just for GNU grep. Chris Cunningham (not at work) - talk 10:12, 22 July 2008 (UTC)
I believe this article
http://www.columbia.edu/~rh120/ch001j.c11
About the origin should be referenced in the references and maybe in the ariticle itself.
What do others think?
Hogan ( talk) 15:31, 4 February 2009 (UTC)
Just take a look, You Can't Grep Dead Trees. It's currently the fourth reference to this article. I left it intact as I'm not sure whether the link to a casual blog post is proper or not. Protez ( talk) 15:56, 16 October 2009 (UTC)
Does it need one? —Preceding unsigned comment added by 65.196.214.163 ( talk) 14:41, 20 October 2009 (UTC)
The date in the man page for Unix 4 does not necessarily mean the creation date. I emailed Ken Thompson himself who clarified it was his private command for quite a while. 208.15.90.2 ( talk) 17:12, 14 January 2014 (UTC)
This goes into the early history of many UNIX commands, including grep, sed, and others. It would be good to include some on Wikipedia: http://www.columbia.edu/~rh120/ch106.x09 Family Guy Guy ( talk) 13:19, 27 August 2023 (UTC)
I'm removing the following example, under the assumption that confusing help is worse than no help at all:
grep -w apple fruitlist.txt | grep -w ^apple$
1. If you're going to do "grep -w ^apple$" there's no point in the preceding command. Or the -w for that matter. 2. The "$" suffix hasn't been explained yet.
If anyone cares to improve this and reinstate it that would be fine with me. 68.110.104.80 ( talk) 02:14, 10 February 2010 (UTC)
I am not sure that not no. 5
^ Zaid Alawi. ""You Can't Grep Dead Trees"". Retrieved 2009-06-09.
is relevant here, I think it should be omitted?? —Preceding unsigned comment added by 76.19.135.92 ( talk) 14:14, 13 July 2010 (UTC)
i believed that the article needed how to ignore a search term as well. it just made sense. Foxwolfblood ( talk) 02:10, 7 November 2010 (UTC)
This would be a lot easier to understand if the article explained the syntax of the command. How do you set the target/scope of a grep search? Stub Mandrel ( talk) 07:02, 27 August 2018 (UTC)
Cyberbot II has detected links on Grep which have been added to the blacklist, either globally or locally. Links tend to be blacklisted because they have a history of being spammed or are highly inappropriate for Wikipedia. The addition will be logged at one of these locations: local or global If you believe the specific link should be exempt from the blacklist, you may request that it is white-listed. Alternatively, you may request that the link is removed from or altered on the blacklist locally or globally. When requesting whitelisting, be sure to supply the link to be whitelisted and wrap the link in nowiki tags. Please do not remove the tag until the issue is resolved. You may set the invisible parameter to "true" whilst requests to white-list are being processed. Should you require any help with this process, please ask at the help desk.
Below is a list of links that were found on the main page:
\bgrepmaster\.eu
on the global blacklistIf you would like me to provide more information on the talk page, contact User:Cyberpower678 and ask him to program me with more info.
From your friendly hard working bot.— cyberbot II NotifyOnline 03:26, 17 October 2014 (UTC)
This contradicts what is currently in the History section of the article, but take a look at Brian Kernighan and Ken Thompson. A nerdy delight for any Vintage Computer Fest 2019 attendee: Kernighan interviewing Thompson about Unix. YouTube. Event occurs at 35m40s to 38m32s. Retrieved September 3, 2019. It seems as if this should be covered in the article. Wtmitchell Wtmitchell (talk) (earlier Boracay Bill) 16:00, 3 September 2019 (UTC)
A lot of search tools fail to find certain file formats, or ignore hits after a certain point in the file, or fail to find non-Roman text in certain file formats. So a list of what formats grep can find would be relevant and useful. 108.51.205.136 ( talk) 19:49, 21 December 2019 (UTC)
In the most recent Computerphile video on YouTube, titled "Coffee with Brian Kernighan", at the very end, Brailsford asks "Who wrote grep?" and Kernighan points at himself, saying "I did".
I always thought Thompson wrote it, but Kernighan really isn't the type to take accomplishments from Thompson, he always shows massive admiration for Thompson. So I am a bit confused. Kernighan saying he wrote it, is as much as a first-hand source as we ever get to. How to proceed?-- 91.64.59.136 ( talk) 13:16, 28 August 2022 (UTC)