Home > Archive > AWK > December 2005 > problems with number (int)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
problems with number (int)
|
|
| chrishunnell@gmail.com 2005-11-30, 7:55 am |
| Hi,
I have a problem with the consecutive numbering of some indizes!
To give a example:
110;a
110;b
131;b
131;c
132;b
132;c
133;b
133;c
....
139;b
139;c
1310;b
1310;c
1311;b
1311;c
140;c
140;d
I want to have:
110;a
131;b
140;c
140;d
If you would think of graph it would look like this:
*-*=*-*
there is one line going from one asterisk to another one and sometimes
there are two lines going (parallel) from one asterisk to another. What
I need is:
*-*-*-*
if there are less than 10 parallel lines i get the problem solved, but
if there are more than 10 parallel lines I have a problem!
i hope you get what my problem is :-)
| |
| chrishunnell@gmail.com 2005-11-30, 7:55 am |
|
chrishunnell@gmail.com wrote:
> Hi,
>
> I have a problem with the consecutive numbering of some indizes!
> To give a example:
> 110;a
> 110;b
> 131;b
> 131;c
> 132;b
> 132;c
> 133;b
> 133;c
> ...
> 139;b
> 139;c
> 1310;b
> 1310;c
> 1311;b
> 1311;c
> 140;c
> 140;d
>
> I want to have:
> 110;a
> 131;b
> 140;c
> 140;d
>
>
> If you would think of graph it would look like this:
> *-*=*-*
> there is one line going from one asterisk to another one and sometimes
> there are two lines going (parallel) from one asterisk to another. What
> I need is:
> *-*-*-*
> if there are less than 10 parallel lines i get the problem solved, but
> if there are more than 10 parallel lines I have a problem!
> i hope you get what my problem is :-)
It is also possible that there are lines "representing" a graph like
*-*=*=*-*
this is an additional problem
| |
| news.t-online.de 2005-12-01, 6:59 pm |
| chrishunnell@gmail.com wrote:
> Hi,
>
> I have a problem with the consecutive numbering of some indizes!
> To give a example:
> 110;a
> 110;b
> 131;b
> 131;c
> 132;b
> 132;c
> 133;b
> 133;c
> ...
> 139;b
> 139;c
> 1310;b
> 1310;c
> 1311;b
> 1311;c
> 140;c
> 140;d
>
> I want to have:
> 110;a
> 131;b
> 140;c
> 140;d
>
>
> If you would think of graph it would look like this:
> *-*=*-*
> there is one line going from one asterisk to another one and sometimes
> there are two lines going (parallel) from one asterisk to another. What
> I need is:
> *-*-*-*
> if there are less than 10 parallel lines i get the problem solved, but
> if there are more than 10 parallel lines I have a problem!
> i hope you get what my problem is :-)
>
BEGIN{
FS=";"
}
{
if(!($2 in FIRSTREFERRED) && ( ! ($1 in OCCURRED)) ){
FIRSTREFERRED[$2]=$1
OCCURRED[$1]=$2
print $1";"$2
}
}
The output on your input:
110;a
131;b
132;c
....;
140;d
|
|
|
|
|