unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Serching for pattern down one column
@ 2008-11-25  0:59 ingvar
  2008-11-25 13:54 ` Paul R
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: ingvar @ 2008-11-25  0:59 UTC (permalink / raw
  To: Help-gnu-emacs


I have a file with binary numbers in colums. Is there any way in emacs to
search for a specific pattern in a column? For example I have the file with
the following:

1  0  0  1
1  1  0  0
0  1  1  1
1  1  1  1
0  0  1  0
0  0  0  0

I now want to search for the pattern "111" in a column (it should find the
pattern in column 2 rows 2-4 and column 3 rows 3-5). Does anyone know how to
do it?

-- 
View this message in context: http://www.nabble.com/Serching-for-pattern-down-one-column-tp20673287p20673287.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Serching for pattern down one column
       [not found] <mailman.1210.1227616965.26697.help-gnu-emacs@gnu.org>
@ 2008-11-25 13:47 ` aartist
  0 siblings, 0 replies; 5+ messages in thread
From: aartist @ 2008-11-25 13:47 UTC (permalink / raw
  To: help-gnu-emacs

On Nov 24, 7:59 pm, ingvar <ing...@nanosi.com> wrote:
> I have a file with binary numbers in colums. Is there any way in emacs to
> search for a specific pattern in a column? For example I have the file with
> the following:
>
> 1  0  0  1
> 1  1  0  0
> 0  1  1  1
> 1  1  1  1
> 0  0  1  0
> 0  0  0  0
>
> I now want to search for the pattern "111" in a column (it should find the
> pattern in column 2 rows 2-4 and column 3 rows 3-5). Does anyone know how to
> do it?
>
> --
> View this message in context:http://www.nabble.com/Serching-for-pattern-down-one-column-tp20673287...
> Sent from the Emacs - Help mailing list archive at Nabble.com.

Consider converting columns into rows and search via regexp.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Serching for pattern down one column
  2008-11-25  0:59 Serching for pattern down one column ingvar
@ 2008-11-25 13:54 ` Paul R
  2008-11-25 15:43 ` Peter Dyballa
       [not found] ` <mailman.1221.1227627817.26697.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 5+ messages in thread
From: Paul R @ 2008-11-25 13:54 UTC (permalink / raw
  To: ingvar; +Cc: Help-gnu-emacs

ingvar> I now want to search for the pattern "111" in a column (it
ingvar> should find the pattern in column 2 rows 2-4 and column 3 rows
ingvar> 3-5). Does anyone know how to do it?

In this particular case I'd first transpose then use classic row-based
facilities.

-- 
  Paul




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Serching for pattern down one column
  2008-11-25  0:59 Serching for pattern down one column ingvar
  2008-11-25 13:54 ` Paul R
@ 2008-11-25 15:43 ` Peter Dyballa
       [not found] ` <mailman.1221.1227627817.26697.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2008-11-25 15:43 UTC (permalink / raw
  To: ingvar; +Cc: Help-gnu-emacs


Am 25.11.2008 um 01:59 schrieb ingvar:

> I now want to search for the pattern "111" in a column (it should  
> find the
> pattern in column 2 rows 2-4 and column 3 rows 3-5). Does anyone  
> know how to
> do it?


I think it's *not* possible to write *one* regular expression to find  
the occurrence in *any* column, though it's possible to write n  
regexps to find the occurrence in exactly one of the n columns.

--
Greetings

   Pete

A lot of us are working harder than we want, at things we don't like  
to do. Why? ...In order to afford the sort of existence we don't care  
to live.
				– Bradford Angier







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Serching for pattern down one column
       [not found] ` <mailman.1221.1227627817.26697.help-gnu-emacs@gnu.org>
@ 2008-11-25 16:29   ` Chris McMahan
  0 siblings, 0 replies; 5+ messages in thread
From: Chris McMahan @ 2008-11-25 16:29 UTC (permalink / raw
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Am 25.11.2008 um 01:59 schrieb ingvar:
>
>> I now want to search for the pattern "111" in a column (it should
>> find the
>> pattern in column 2 rows 2-4 and column 3 rows 3-5). Does anyone
>> know how to
>> do it?
>
>
> I think it's *not* possible to write *one* regular expression to find
> the occurrence in *any* column, though it's possible to write n
> regexps to find the occurrence in exactly one of the n columns.
>
> --
> Greetings
>
>   Pete
>
> A lot of us are working harder than we want, at things we don't like
> to do. Why? ...In order to afford the sort of existence we don't care
> to live.
> 				– Bradford Angier

How about a simple lisp function that would query the user for the
column (or take it from the current cursor position) and plug that into
a regexp to search?

- chris

-- 
     (.   .)
  =ooO=(_)=Ooo=====================================
  Chris McMahan | first_initiallastname@one.dot.net
  =================================================


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-11-25 16:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-25  0:59 Serching for pattern down one column ingvar
2008-11-25 13:54 ` Paul R
2008-11-25 15:43 ` Peter Dyballa
     [not found] ` <mailman.1221.1227627817.26697.help-gnu-emacs@gnu.org>
2008-11-25 16:29   ` Chris McMahan
     [not found] <mailman.1210.1227616965.26697.help-gnu-emacs@gnu.org>
2008-11-25 13:47 ` aartist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).