Problem typing correction 
Author Message
 Problem typing correction

In my problem message i made a typing error:(i put o instead of zero)
here is the corrected message:
I have a problem that no body seems to be able to answer:
I have an ascii file with two columns that goes like this
f0  1
f0  1
f0  1
f1  2
f1  2
f1  2
f1  2
and so on after f1 there is f2 with 3's in the second column and so on
I would like to format this file so that for each set e.g f0 or
f1...the second column starts with 1 every thing in between is 2 and
ends in 3 so the file will end like that

f0  1
f0  2
f0  3
f1  1
f1  2
f1  2
f1  3
and so on
I would very much appreciate if someone can help me to solve this
problem
Thanks

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sat, 25 May 2002 03:00:00 GMT  
 Problem typing correction

Quote:

> In my problem message i made a typing error:(i put o instead of zero)
> here is the corrected message:
> I have a problem that no body seems to be able to answer:

Well, I do think many of us are able to answer. It's just that it's not
so much a question as it is a request for someone to do your work. It's
for task like that you have computer consultants. =)

Quote:
> I have an ascii file with two columns that goes like this
> f0  1
> f0  1
> f0  1
> f1  2
> f1  2
> f1  2
> f1  2
> and so on after f1 there is f2 with 3's in the second column and so on
> I would like to format this file so that for each set e.g f0 or
> f1...the second column starts with 1 every thing in between is 2 and
> ends in 3 so the file will end like that

> f0  1
> f0  2
> f0  3
> f1  1
> f1  2
> f1  2
> f1  3
> and so on

But since X-mas is soon here I'll have a go at it:

awk '
{ fields[$1]++ }
END {
  for (f in fields) {
    print f, 1
    for(i=2; i<fields[f]; i++)
      print f, 2
    print f, 3
  }

Quote:
}

' infile | sort

Regards,
/Peter
--
-= Spam safe(?) e-mail address: pez68 at netscape.net =-

Sent via Deja.com http://www.deja.com/
Before you buy.



Sat, 25 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to Use Abstract Data Types (correction)

2. Correction, correction...

3. simple programming problem correction

4. Correction to socket problem on DEC Alpha

5. Data Type Problem - COM Beginner's question

6. File types - icon problem

7. File Type Problems

8. Data Type problems

9. RI Problem on Handcoded Form type proc

10. Illegal Return Type problem

11. 'type' problem

12. Having problem creating an object of type UNIX_FILE

 

 
Powered by phpBB® Forum Software