Re: grep command

2010-06-10 Thread rantingrick
On Jun 10, 7:56 am, "D'Arcy J.M. Cain" wrote: > On Thu, 10 Jun 2010 08:26:58 +0100 > I'm surprised that there is anyone left who hasn't killfiled this guy. > He/she hasn't made any effort to understand the group.  Why bother even > answering him?  Just filter him and enjoy the silence. All this

Re: grep command

2010-06-10 Thread D'Arcy J.M. Cain
On Thu, 10 Jun 2010 08:26:58 +0100 Simon Brunning wrote: > On 10 June 2010 07:38, madhuri vio wrote: > > i was wondering bout the usage and syntax of > > grep command..can u tall me its syntax so that > > i can use it and proceed...pls > > That's really not on topic for this list. I'm surprised

Re: grep command

2010-06-10 Thread Simon Brunning
On 10 June 2010 07:38, madhuri vio wrote: > > i was wondering bout the usage and syntax of > grep command..can u tall me its syntax so that > i can use it and proceed...pls That's really not on topic for this list. -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list

Re: Grep Equivalent for Python

2007-03-19 Thread tereglow
On Mar 18, 7:33 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > > > > > > tereglow <[EMAIL PROTECTED]> wrote: > >On Mar 15, 1:47 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > >> tereglow <[EMAIL PROTECTED]> wrote: > > >>>grep^MemTotal /proc/meminfo | awk '{print $2}' > > >>

Re: Grep Equivalent for Python

2007-03-18 Thread Aahz
In article <[EMAIL PROTECTED]>, tereglow <[EMAIL PROTECTED]> wrote: >On Mar 15, 1:47 am, [EMAIL PROTECTED] (Alex Martelli) wrote: >> tereglow <[EMAIL PROTECTED]> wrote: >>> >>>grep^MemTotal /proc/meminfo | awk '{print $2}' >> >> If you would indeed do that, maybe it's also worth learning something

Re: Grep Equivalent for Python

2007-03-18 Thread tereglow
On Mar 15, 1:47 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > tereglow <[EMAIL PROTECTED]> wrote: > >... > > > server using the /proc FS. For example, in order to obtain the amount > > of physical memory on the server, I would do the following in shell: > > >grep^MemTotal /proc/meminfo | awk

Re: Grep Equivalent for Python

2007-03-14 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > tereglow <[EMAIL PROTECTED]> wrote: >... > > server using the /proc FS. For example, in order to obtain the amount > > of physical memory on the server, I would do the following in shell: > > > > grep ^MemTotal /proc/meminfo | awk '{print $2}' > > If you would indeed do

Re: Grep Equivalent for Python

2007-03-14 Thread Alex Martelli
tereglow <[EMAIL PROTECTED]> wrote: ... > server using the /proc FS. For example, in order to obtain the amount > of physical memory on the server, I would do the following in shell: > > grep ^MemTotal /proc/meminfo | awk '{print $2}' If you would indeed do that, maybe it's also worth learnin

Re: Grep Equivalent for Python

2007-03-14 Thread [EMAIL PROTECTED]
On Mar 14, 10:57 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Laurent Pointal wrote: > > > Steve Holden a écrit : > >> Regular expressions aren't really needed here. Untested code follows: > > >> for line in open('/proc/meminfo').readlines: > > for line in open(

Re: Grep Equivalent for Python

2007-03-14 Thread Fabio FZero
On Mar 14, 9:37 am, "tereglow" <[EMAIL PROTECTED]> wrote: > Hello all, > > I come from a shell/perl background and have just to learn python. To > start with, I'm trying to obtain system information from a Linux > server using the /proc FS. For example, in order to obtain the amount > of physical

Re: Grep Equivalent for Python

2007-03-14 Thread Steve Holden
tereglow wrote: > Okay, > > It is now working as follows: > > memFile = open('/proc/meminfo') > for line in memFile.readlines(): > if line.startswith("MemTotal"): > memStr = line.split() > memTotal = memStr[1] > memFile.close() > print "Memory: " + memTotal + "kB

Re: Grep Equivalent for Python

2007-03-14 Thread tereglow
Okay, It is now working as follows: memFile = open('/proc/meminfo') for line in memFile.readlines(): if line.startswith("MemTotal"): memStr = line.split() memTotal = memStr[1] memFile.close() print "Memory: " + memTotal + "kB" I'm learning the whole try, f

Re: Grep Equivalent for Python

2007-03-14 Thread tereglow
On Mar 14, 11:57 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Laurent Pointal wrote: > > > Steve Holden a écrit : > >> Regular expressions aren't really needed here. Untested code follows: > > >> for line in open('/proc/meminfo').readlines: > > for line in open(

Re: Grep Equivalent for Python

2007-03-14 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Laurent Pointal wrote: > Steve Holden a écrit : >> Regular expressions aren't really needed here. Untested code follows: >> >> for line in open('/proc/meminfo').readlines: > for line in open('/proc/meminfo').readlines(): for line in open('/proc/meminfo'): >> if line.s

Re: Grep Equivalent for Python

2007-03-14 Thread BJörn Lindqvist
> I come from a shell/perl background and have just to learn python. To > start with, I'm trying to obtain system information from a Linux > server using the /proc FS. For example, in order to obtain the amount > of physical memory on the server, I would do the following in shell: > > grep ^MemTo

Re: Grep Equivalent for Python

2007-03-14 Thread Laurent Pointal
Steve Holden a écrit : > Regular expressions aren't really needed here. Untested code follows: > > for line in open('/proc/meminfo').readlines: for line in open('/proc/meminfo').readlines(): > if line.startswith("Memtotal:"): > name, amt, unit = line.split() > print name, amt,

Re: Grep Equivalent for Python

2007-03-14 Thread Paul Boddie
On 14 Mar, 13:37, "tereglow" <[EMAIL PROTECTED]> wrote: > Hello all, > > I come from a shell/perl background and have just to learn python. Welcome aboard! > To start with, I'm trying to obtain system information from a Linux > server using the /proc FS. For example, in order to obtain the amou

Re: Grep Equivalent for Python

2007-03-14 Thread Steve Holden
tereglow wrote: > Hello all, > > I come from a shell/perl background and have just to learn python. To > start with, I'm trying to obtain system information from a Linux > server using the /proc FS. For example, in order to obtain the amount > of physical memory on the server, I would do the fol

Re: grep

2005-10-25 Thread David Isaac
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote:: def grep(pattern, *files): search = re.compile(pattern).search for file in files: for index, line in enumerate(open(file)): if search(line): print ":".join((file, str(index+1), line[:-1])

Re: grep

2005-10-25 Thread Fredrik Lundh
"marduk" wrote: >> What's the standard replacement for the obsolete grep module? > > AFAIK there never was a "grep" module. There does, however exist a > deprecated "regex" module: there was a "grep" module in 1.5.2 and earlier: http://effbot.org/librarybook/grep.htm but it was removed in

Re: grep

2005-10-25 Thread marduk
On Tue, 2005-10-25 at 06:45 +, David Isaac wrote: > What's the standard replacement for the obsolete grep module? AFAIK there never was a "grep" module. There does, however exist a deprecated "regex" module: >>> import regex __main__:1: DeprecationWarning: the regex module is deprecated; ple

[OT] Re: "grep" database

2005-09-09 Thread Ara . T . Howard
On Fri, 9 Sep 2005, Hilbert wrote: > Hello, > > I've heard of a software on linux that creates a recursive database of > text files and then provides an interface for grep-like queries. I'd > like to use it to find procedures/variables in a large code base. > > Any suggestions appreciated. > > Th

Re: "grep" database

2005-09-09 Thread gene tani
maybe look Gonzui, LXR, some of the other tools listed here http://www.gnu.org/software/global/links.html Hilbert wrote: > Hello, > > I've heard of a software on linux that creates a recursive database of > text files and then provides an interface for grep-like queries. I'd > like to use it to

Re: "grep" database

2005-09-09 Thread Mike Meyer
"Hilbert" <[EMAIL PROTECTED]> writes: > I've heard of a software on linux that creates a recursive database of > text files and then provides an interface for grep-like queries. I'd > like to use it to find procedures/variables in a large code base. > > Any suggestions appreciated. The great gran

Re: "grep" database

2005-09-09 Thread Hilbert
thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: "grep" database

2005-09-09 Thread Adam Monsen
ctags indexes procedures/variables in source code, perhaps it would help: http://ctags.sf.net/ -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list