Find the answer to your Linux question:
Results 1 to 4 of 4
I'm writing a program that needs to be able to match different types of fields. These fields include date/time, numbers, and strings. I'm just not quite sure of how I ...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6

    matching fields

    I'm writing a program that needs to be able to match different types of fields.
    These fields include date/time, numbers, and strings. I'm just not quite sure of how I want to accomplish this task.

    I could fork to grep for string matching, I am not experienced enough to know whether or not this is a good design choice.

    Still, I don't know if I'd need to build my own matching system for date/time and numbers. I would think general math and comparison operations would be good for numbers, I don't know what might be good for matching a date/time generically.

    Any ideas?

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Have you decided yet what programming language you'll use?

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6
    Well, I'm using C. I understand it would probably be a lot easier in Perl, but I haven't taught myself Perl as of today.

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    If you're using C, then do this at the command line:
    Code:
    man -a regex
    (not regexp).

    You'll have fun using that regular expression library in your program. Another alternative is:
    Code:
    man pcre
    You could fork() and use grep, but what's the sport in that?

    If you do decide to do it that way, don't call grep and use fork(); call grep by using popen(). It takes care of a lot of the extra processing bookwork for you. (Don't forget that pclose() at the end, to maximize longterm maintainability of your code.)

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...