csv2lyx - converter from csv-file to a LyX table
Converts a Comma Separated Value file to a float table in LyX format. Good for LyX version 1.1.4fix1 and other. You can use it whit the LyX-server too.
under Linux one of the follow (see also the many Options):
antonio@bidone:~ > cat mycsvfile | csv2lyx > mytmptable.lyx antonio@bidone:~ > cat mycsvfile | csv2lyx --output=mytmptable.lyx antonio@bidone:~ > csv2lyx mycsvfile > mytmptable.lyx antonio@bidone:~ > csv2lyx mycsvfile --output=mytmptable.lyx antonio@bidone:~ > csv2lyx mycsvfile -o mytmptable.lyx antonio@bidone:~ > csv2lyx mycsvfile --lyxserver
As default this will create a Float-Table in the LyX format, version 2.15 (used by LyX-1.1.4fix1 but readable by higher versions as well).
-s or --separator="what you want" -o or --output='A filename, please!' -l or --label='A label for crossreference to the table' -f or --fontsize=-3|-2|-1|+1|+2|+3 -c or --colspan="a pattern" or --multicolumn="a pattern" -vl or --vlines -hl or --hlines -g or --grid -b or --border -h or --header='N' -t or --title="A pretty title for a pretty table" -L or --lyxserver --nofloat --help
-f or --fontsize=-3|-2|-1|+1|+2|+3
-1 means small, -2 means smaller , +1 means large, and so on. Very usefull in LyX-1.1.6, where formatting each cell is very cumbersome.
-s or --separator="what you want"
default: ``\t'' for a tab-separated file
-o or --output='A filename, please!'
default: STDOUT aka Screen. That means, that you can use the pipe, if you want:
antonio@bidone > csv2lyx pippo.csv > pippo.lyx
is the same as
antonio@bidone > csv2lyx pippo.csv -o pippo.lyx
If you use --lyxserver, then --output is overwriten by a random filename.
-L or --lyxserver
With this option, you can past the table direct in a LyX-document at the current editing point (the place of the cursor).
Of course, to have this working, you need to have an open LyX-document.
This option is valid only when the lyxserver is started:
What's the ``lyxserver''?
Good question. A partial, but simple answord is: go in your lyxrc and write the line
\serverpipe "~/.lyxpipe"
The lyxserver works on *NIX, OS/2, but not Win32!
If you have problems, close LyX, rm ~/.lyxpipe.in and ~/.lyxpipe.out. Restart. Better: look on the LyX-Documentation ``Configuration.lyx''.
-t or --title="A pretty title for a pretty table"
default: inputfilename otherwise, when you use the pipe, ``Title of the LyX | |
table'' |
-l or --label='A label for crossreference to the table'
default: none
If you don't want a Float-Table. In this case the options --title and --label are ignored.
default: Float-Table
-h or --header='N' (--header is the same as --header='1')
The first N rows are a Header.
Default: noheader
A line is made under the last row of the Header. If --border, --grid or --hlines are activated, then are two lines unter the last row of the Header.
-b or --border
A line around the table.
Default: noborder
-g or --grid
All cells separated by lines. The same as --border, --vlines, --hlines.
Default: nogrid
-hl or --hlines
Horizonal line between each row.
-vl or --vlines
Vertical lines between each column.
-c or --colspan="a pattern"
Multicolumns: cells that span over several columns
One can indicate, line for line whether some columns should be joined. Number n indicates how many columns the nth value should be in. The slash separates lines. If less than the existing columns are indicated, the remaining numbers are assumed to be 1 (i.e. one column per value). Also, 'empty' lines are automatically set to 'normal' (one column per value).
Here are some examples:
+-------------+----------------------+ 1 | 2 columns | 3 columns | +-----+-------+-----+--------+-------+ 2 | | | | | |
+-------------+----------------------+ 1 | 2 columns | 3 columns | +-----+-------+-----+--------+-------+ 2 | 2 columns | 2 columns | 1 col | +-----+-------+-----+--------+-------+ 3 | | | | | |
+-------------+----------------------+ 1 | 2 columns | 3 columns | +-----+-------+-----+--------+-------+ 2 | | | | | | +-----+-------+-----+--------+-------+ 3 | 2 columns | 2 columns | 1 col | +-----+-------+-----+--------+-------+ 4 | | | | | |
+-----+-------+-------+--------+-------+ 1 | | | | | | +-----+-------+-------+--------+-------+ 2 |1 col| 2 columns | | | +-----+-------+-------+--------+-------+ 3 | 2 columns | 1 col | 2 columns | +-----+-------+-------+--------+-------+ 4 | | | | | |
Next features are:
Using --lyxserver your data are on the /tmp
directory. Maybe
everybody can see your data.
Copyright (C) 2001, Antonio Gulino <antonio.gulino@tin.it>
This program is free software; you can redistribute it and/or modify it under the term of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
Thanks to Guenter Milde <G.Milde@physik.tu-dresden.de> for translation and improvement of the Documentation.