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

... I have already implemented that:

RCS file: /grassrepository/grass6/vector/v.in.ascii/in.c,v
retrieving revision 1.19
diff -u -r1.19 in.c
--- in.c 8 Feb 2005 12:57:38 -0000 1.19
+++ in.c 18 Feb 2005 17:13:40 -0000
@@ -16,7 +16,7 @@
        struct Option *old, *new, *delim_opt, *columns_opt, *xcol_opt,
                *ycol_opt, *zcol_opt, *catcol_opt, *format_opt;
        int xcol, ycol, zcol, catcol, format;
- struct Flag *zcoorf, *t_flag, *e_flag;
+ struct Flag *zcoorf, *t_flag, *e_flag, *noheader_flag;
        char *table;
        char *fs;
        int zcoor=WITHOUT_Z, make_table;
@@ -109,7 +109,11 @@
        e_flag = G_define_flag();
        e_flag->key = 'e';
        e_flag->description = "Create a new empty map and exit. Nothing
is read from input.";
-
+
+ noheader_flag = G_define_flag();
+ noheader_flag->key = 'n';
+ noheader_flag->description = "Don't expect a header when reading in
standard format";
+
        if (G_parser (argc, argv))
                exit(-1);

@@ -370,7 +374,8 @@
            fclose (tmpascii);
        } else {
             /* FORMAT_ALL = standard mode */
- read_head(ascii, &Map);
+ if ( ! noheader_flag->answer )
+ read_head(ascii, &Map);
            asc_to_bin(ascii, &Map) ;
        }

To me it does not look intrusive. I can submit whenever
desired. Please suggest.

Markus

-------------------------------------------- Managed by Request Tracker

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