Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20510 > unrolled thread

Re: Reading sub-string from a file

Started byChris Angelico <rosuav@gmail.com>
First post2012-02-16 21:32 +1100
Last post2012-02-16 21:32 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Reading sub-string from a file Chris Angelico <rosuav@gmail.com> - 2012-02-16 21:32 +1100

#20510 — Re: Reading sub-string from a file

FromChris Angelico <rosuav@gmail.com>
Date2012-02-16 21:32 +1100
SubjectRe: Reading sub-string from a file
Message-ID<mailman.5884.1329388334.27778.python-list@python.org>
On Thu, Feb 16, 2012 at 8:52 PM, Smiley 4321 <ssmile03@gmail.com> wrote:
> int Jockey_Apple_cat_1KK(float, int, char, int);
> int Jockey_Apple_cat_look(int, float, int, int);
> int Jockey_Apple_cat_test_ki21es(int, int, int, int);
> int Jockey_Apple_cat_tarLK12OU(void, int, int, int);
> ---
>
> Here substring "Jockey_Apple_cat" is common from 3rd line onwards as a
> function name. I wish to extract ONLY that function name which has
> 'Jockey_Apple_cat' as a substring and ignore remaining function names.

Try this:

grep -o 'Jockey_Apple_cat[^(]*' test.conf

It's not Python, but it might serve you better than knocking something
together! But if you're using this to learn Python, Peter Otten's
solution is, I think, what you want.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web