[GRASS5] [bug #2997] (grass) v.in.ascii: add skip header lines option

Hamish hamish_nospam at yahoo.com
Mon Feb 21 22:22:23 EST 2005


>> Subject: v.in.ascii: add skip header lines option
>>
>> (points mode)
>> It would be nice if v.in.ascii had a skip=int option to skip the top
>> n lines of an input file. Often a .csv file will have a comment and
>> column headings at the start of the file and data will start on line
>> 3-5. Resaving without is a pain and leaves behind .csv data files
>> which are impossible to figure out even just an hour later (at least
>> for me).
>>
Markus wrote:
>
> ... I have already implemented that:
> 
..
> +        noheader_flag = G_define_flag();
> +        noheader_flag->key          = 'n';
> +        noheader_flag->description  = "Don't expect a header when reading in standard format";
[...]
> -           read_head(ascii, &Map);
> +           if ( ! noheader_flag->answer )
> +                   read_head(ascii, &Map);
>             asc_to_bin(ascii, &Map) ;



That will be nice for scripts, but I was talking about the header info
in points mode when dealing with .csv files with column headings:

in.txt:
------------
Test data collected 22 Feb 2005.

cat,x,y,distance (m),data1
1,12345,67890,2.4,0.002
2,12352,67012,6.8,0.014
3,12326,66587,10.2,0.102
...
-------------

here I want to have "skip=3" so it starts reading data on the 4th line.



Hamish




More information about the grass-dev mailing list