How would I append row numbers to a list?

I read lines as followslines: read0 `:sample.csvHow would I add row numbers 1…n to the list? For examplenew york, usaparis, franceberln, germanyto1,new york, usa2,paris, france3,berln, germany

How about:

lines: string[1+ til count lines],'lines: “,”,'read0 `:sample.csv

Alternatively read it as a table:

lines: update lineNo:i+1 from (“SS”; enlist “,”)0: `:sample.csv

regards
wieslaw

Dnia 03-11-2011 o 13:02 otrzymano wiadomo?? od John Knijff

I read lines as follows

lines: read0 `:sample.csv

How would I add row numbers 1…n to the list? For example

new york, usa
paris, france
berln, germany

to

1,new york, usa
2,paris, france
3,berln, germany


Submitted via Google Groups

To: personal-kdbplus@googlegroups.com
X-Mailer: Apple Mail (2.1251.1)

(til count lines),’ lines

Thank you both solutions work greatOn Nov 3, 1:33?pm, Felix Lungu <felix.lu…> wrote:> (til count lines),’ lines>> On 3 Nov 2011, at 14:02, John Knijff wrote:>> > I read lines as follows>> > lines: read0 `:sample.csv>> > How would I add row numbers 1…n to the list? ?For example>> > new york, usa> > paris, france> > berln, germany>> > to>> > 1,new york, usa> > 2,paris, france> > 3,berln, germany>> > –> >

Submitted via Google Groups</felix.lu…>