Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Sum a numbers of a row
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Roberto Zuelli  
View profile  
 More options Oct 16 2012, 12:46 pm
Newsgroups: comp.lang.awk
From: Roberto Zuelli <roberto...@gmail.com>
Date: Tue, 16 Oct 2012 09:46:00 -0700 (PDT)
Subject: Re: Sum a numbers of a row
On Oct 16, 5:20 pm, Janis Papanagnou <janis_papanag...@hotmail.com>
wrote:

> On 16.10.2012 18:10, Roberto Zuelli wrote:

> > On Oct 16, 4:16 pm, Janis Papanagnou <janis_papanag...@hotmail.com>
> > wrote:
> >> On 16.10.2012 16:07, Roberto Zuelli wrote:

> >>> On Oct 16, 1:53 pm, Roberto Zuelli <roberto...@gmail.com> wrote:
> >>>> On Oct 15, 7:30 pm, Luuk <l...@invalid.lan> wrote:

> >>>>> On 15-10-2012 17:30, Roberto Zuelli wrote:

> >>>>>> I use awk in another language (GAMS)

> >>>>>http://www.gams.com?

> >>>> Yes Luuk, I use that GAMS...

> >>>> Thanks everybody for everything.

> >>>> Roberto

> >>> Sorry, but I have another problem...
> >>> I have a file like this:
> >>> Links  From   To      r
> >>> AA1    BUS1   BUS2    1
> >>> AA2    BUS3   BUS4    2
> >>> AA3    BUS2   BUS4    8
> >>> AA4    BUS1   BUS3    2
> >>> AA5    BUS3   BUS2    1

> >>> I'd like to print all the buses that appear in the 2 columns (from and
> >>> to) but just one time per each bus:
> >>> BUS1
> >>> BUS2
> >>> BUS3
> >>> BUS4
> >>> BUS5

> >> I don't see where you've got that BUS5 from.

> >> Here's an awk command to play with...

> >>    awk 'NR>1{a[$2];a[$3]}END{for(b in a)print b}'

> >> Janis
> >> The command that you gave me will not work correctly if I've something like this:
> > Links  From   To      r
> > AA1    BUS1   BUS2    1
> > AA2    BUS3   BUS4    2
> > AA3    BUS2   BUS4    8
> > AA4    BUS1   BUS3    2
> > AA5    BUS5   BUS6    1
> > AA6    BUS7   BUS5    2
> > AA7    BUS2   BUS6    1

> > I mean, it will not print, for example, BUS6, isn't it?

> Certainly it does, and it will also print BUS7, as it is in your newly
> presented data. - Have you tried my script at all?

Yes I've tried the command you suggested me but it works in a
particular way: it prints more than 1 time the same bus...

> Sorry, I don't understand what you are trying to say here. If you have
> problems describing it with words, please provide sample data to make
> your intention clear. And if I say sample data, I mean sample data that
> will be appropriate to show what you want.

I've a list of buses in two different columns, my goal is to print 1
time all the possible buses present in the 2 columns
NB certain buses compare just in the first column, certain other in
the second column and certain other in both the columns).

R.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.