Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    29

    Question Unanswered: Tokenize key/value pairs in a log file

    I have a sample file that contains entries like:

    age=24 gender=male height=63 weight=180 eyecolor=blue haircolor=blonde
    age=21 gender=female height=52 weight=140 eyecolor=hazel haircolor=brown
    age=27 gender=female height=48 weight=127 eyecolor=brown haircolor=black

    etc.

    I know how to handle comma or tab delimited data, but not when the variables are being referenced with the data. I have a table setup with each variable as a column. In some cases, I may have a sample file that only has some of these variables, or maybe more, and may not have them in the same order. So I cannot rely on the position of this data.

    What is the best way to token this so I can import it into my table?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    consider using the split function to parse the incoming record
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2004
    Posts
    29
    What are the differences between split and explode, that would make me consider one over the other in this scenario?

Posting Permissions

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