linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Pattern matching programming
@ 2005-05-18 17:36 fabio
  2005-05-18 20:09 ` Fabrizio Sestito
  2005-05-20 20:36 ` Glynn Clements
  0 siblings, 2 replies; 4+ messages in thread
From: fabio @ 2005-05-18 17:36 UTC (permalink / raw)
  To: linux-c-programming

Hello,

I am trying to code a small C program that basically takes a long text
file with data that comes from a mysql server.

But I realize It is better to use regular expression. This is an examples
of the text:

=1 <p> blah </p> <div foo>{$foobar}</div>blah.... <p>linux rulez</p>
misc characters.... =2 blah blah <p> linux rulez again</p>.... <p>foo</p?blah


And so on.

The patterns are:

The record is represented by an equal. Ej, record 1 is "=1", record 2 is
"=2" and so on.

The desired text is where "linux rulez" is inside, it is the FIRST <p>
</p> AFTER a record.

So, I see that program this makes no sense because it is better to use sed
and awk.

The result I want to have is something like:

1 linux rulez
2 linux rulez again
3 linux rulez so far
...etc

The idea is elimate all <div>'s tags, then get the numbers (maybe with awk
-F"="), and then get the next <p> taq, remove the tags themself and
numbers and then the text and do the same procedure for all the 65230
records.

Thanks alot for any comment, sorry for the 'offtopic'

Kind regards,

fabio




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

end of thread, other threads:[~2005-05-20 20:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-18 17:36 Pattern matching programming fabio
2005-05-18 20:09 ` Fabrizio Sestito
2005-05-20  1:55   ` Hareesh Nagarajan
2005-05-20 20:36 ` Glynn Clements

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 NNTP newsgroup(s).