Connecting Tech Pros Worldwide Help | Site Map

can slurp do this?

  #1  
Old July 16th, 2008, 07:55 AM
Geoff Cox
Guest
 
Posts: n/a
hello

Say I am interested in users giving me values for a, b, c and d.

I have a file with all the results - a very big file!

user 1
a: one
b: two
d: four

user 2
a: one
b: two
c: three
d: four

etc etc

and want to create a file

user a b c d
1 one two x four
2 one two three four

etc etc

How do I put in an x for c for user 1, indicating that this user
didn't submit a value for c?

I slurping the way to do it?

Cheers

Geoff
  #2  
Old July 16th, 2008, 02:55 PM
Jürgen Exner
Guest
 
Posts: n/a

re: can slurp do this?


Geoff Cox <gcox@freeuk.notcomwrote:
Quote:
>hello
>
>Say I am interested in users giving me values for a, b, c and d.
>
>I have a file with all the results - a very big file!
>
>user 1
>a: one
>b: two
>d: four
>
>user 2
>a: one
>b: two
>c: three
>d: four
>
>etc etc
>
>and want to create a file
>
>user a b c d
>1 one two x four
>2 one two three four
>
>etc etc
>
>How do I put in an x for c for user 1, indicating that this user
>didn't submit a value for c?
>
>I slurping the way to do it?
No need for slurping in the whole file. If you know the set of all a, b,
c, d, ... in advance then just go ahead and create the top row. Then
read in the information for each user and print the row for him.
If you don't know the set of all a, b, c, ... in advance then read the
file twice: first pass just to determine the set of a, b, c, ... and the
second pass as above.

jue
  #3  
Old July 16th, 2008, 04:45 PM
Geoff Cox
Guest
 
Posts: n/a

re: can slurp do this?


On Wed, 16 Jul 2008 13:51:15 GMT, Jürgen Exner <jurgenex@hotmail.com>
wrote:
Quote:
>Geoff Cox <gcox@freeuk.notcomwrote:
Quote:
>>hello
>>
>>Say I am interested in users giving me values for a, b, c and d.
>>
>>I have a file with all the results - a very big file!
>>
>>user 1
>>a: one
>>b: two
>>d: four
>>
>>user 2
>>a: one
>>b: two
>>c: three
>>d: four
>>
>>etc etc
>>
>>and want to create a file
>>
>>user a b c d
>>1 one two x four
>>2 one two three four
>>
>>etc etc
>>
>>How do I put in an x for c for user 1, indicating that this user
>>didn't submit a value for c?
>>
>>I slurping the way to do it?
>
>No need for slurping in the whole file. If you know the set of all a, b,
>c, d, ... in advance then just go ahead and create the top row. Then
>read in the information for each user and print the row for him.
>If you don't know the set of all a, b, c, ... in advance then read the
>file twice: first pass just to determine the set of a, b, c, ... and the
>second pass as above.
>
>jue
thanks Jue - will give this a try.

Cheers

Geoff
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you avoid that googlebot indexes PHPSESSID pages? CAH answers 29 April 12th, 2006 09:15 PM
How can I tell if a visitor is a search engine bot? Mark answers 4 November 19th, 2005 03:04 AM
This page is not a valid HTML 4.01.WHY? Steal answers 25 July 23rd, 2005 11:36 PM
Question abour reading file Eric Caron answers 2 July 21st, 2005 09:49 AM