[Site Home] [Forum Home] [Articles] [File DB] [News Archives]

IceTeks Articles -> Text searching in linux with grep


(View original topic)


Chris - Aug-24-2005 server time
Try Windows Grep. I use it and it's great.

Shinizo - Jun-25-2005 server time
Do you want an apple pie with that?

Rizwan - Jun-25-2005 server time
Great article . Grep was appearing really greek to me before this , as I am new to linux.

Tim Abell - Jun-13-2005 server time
http://cygwin.com/
contains grep built for win32
install then add c:\cygwin\bin to your path

Red Squirrel - Apr-27-2005 server time
I think grep is only a linux thing, but there is a windows program that does the same but I forget what it's called.

Bob Mance - Apr-27-2005 server time
Hi,

I am looking for a grep on Windows and cannot find one. I have installed the Microsoft Platform SDK from Feb 2003, and it is not in the bin directory.

Can someone help me find this? I miss Linux..... sad.gif

Alarido - Feb-15-2005 server time
I want to add to things.

There is a GNU grep conversion to Windows and Microsoft provides another with 2003 resource kit (qgrep).

The only file editor you can use to open and search big files in windows is Ultraedit32, it can open any size in a few seconds and it have a very fast and powerfull search too, it's not free but its de best text editor i know under windows.

Red Squirrel - Feb-14-2005 server time
These tests are done on RH8.0 which is considered somehwhat old so it could be possible that things got changed.

And the reason for the -l was to have 1 file per line, since the other is multiple files per line which achieves undesirable results in these examples. Though the results would of been the same if I would of put the words in a file line per line, but just wanted to show examples using real-time situations.

Wulf - Feb-14-2005 server time
Sorry, I didn't notice that you were looking for files without an O anywhere in the filename. Why don't you just

ls |grep -v -i O

?

Wulf - Feb-14-2005 server time
Nice introduction to grep for Windows users. I believe you can actually download grep (and lots of other Linux utils) for windows, saving you a copy to a linux box.
Your last example - files not ending in 'o' has a couple of problems. On my (up-to-date) version of linux grep does not support a -P option, and older files do not show the time in a dir -l, meaning that your search trick won't work. If you want the last letter to be one of o or O, then instead of the suggested

dir -l |grep -P -v -i "\:[0-9][0-9].+o"

I would use

dir -l |grep -v -i "o$"

which is slightly simpler and should always work.

Red Squirrel - Feb-12-2005 server time
Grep is a linux command that is often overlooked but can be very useful when searching for stuff from a single string to a complicated regular expression. This article scratches the surface on it's power and should leave you with enough information to discover new uses for it.

http://www.iceteks.com/articles.php/grep/1


(Showing 50 last posts, newest on top)