Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20510
| References | <CAJ1erZ1izVQVHQj3tt4y5HoumQv0bM9qDp40fMehKzYewnfUVQ@mail.gmail.com> |
|---|---|
| Date | 2012-02-16 21:32 +1100 |
| Subject | Re: Reading sub-string from a file |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5884.1329388334.27778.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Reading sub-string from a file Chris Angelico <rosuav@gmail.com> - 2012-02-16 21:32 +1100
csiph-web