10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
My source file looks like this:
Cust-Number = "101"
Cust-Name="Joe"
Cust-Town="London"
Cust-hobby="tennis"
Cust-purchase="200"
Cust-Number = "102"
Cust-Name="Mary"
Cust-Town="Newyork"
Cust-hobby="reading"
Cust-purchase="125"
Now I want to parse this file (leaving out hobby) and... (10 Replies)
Discussion started by: Balav
10 Replies
2. Shell Programming and Scripting
Consolidate several lines of a CSV file with firewall rules
Hi guys.
I have a CSV file, which I created using an HTML export from a Check Point firewall policy.
Each rule is represented as several lines, in some cases. That occurs when a rule has several address sources, destinations or... (4 Replies)
Discussion started by: starriol
4 Replies
3. UNIX for Dummies Questions & Answers
Hello !
I am very aware that this is not the first time this question is asked here, because I have already read a lot of previous answers, but none of them worked, so...
As said in the title, I want to read a csv file with a bash script.
Here is a sample of the file:
... (4 Replies)
Discussion started by: Grhyll
4 Replies
4. Shell Programming and Scripting
Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database.
I need to write the korn shell program on Red Hat Enterprise Linux server.
Oracle database is 10g. (15 Replies)
Discussion started by: shellguy
15 Replies
5. Shell Programming and Scripting
Hello Expert,
I have a file in the following format:
SYNTAX_VERSION 5
MONITOR "NAME_TEMPLATES"
DESCRIPTION "Monitors for contents of error "
INTERVAL "1m"
MONPROG "script.sh NAME_TEMPLATES"
MAXTHRESHOLD
GEN_BELOW_RESET
SEVERITY Major
... (17 Replies)
Discussion started by: Ant-one
17 Replies
6. Shell Programming and Scripting
#!/bin/bash
i=0
cat 1.csv | while read fileline
do
echo "$fileline"
IFS="#" flds=( $fileline )
nrofflds=${#flds}
echo "noof fields$nrofflds"
fld=0
while
do
echo "noof counter$fld"
echo "$nrofflds"
#fld1="${flds}" trying to store the content of line to fields but i... (4 Replies)
Discussion started by: barani75
4 Replies
7. Shell Programming and Scripting
Hi,
It's been a few years since college when I did stuff like this all the time. Can someone help me figure out how to best tackle this problem? I need to parse a file full of entries that look like this:
<eq action="A" sectyType="0" symbol="PGR" exch="CA" curr="VEF" sess="NORM"... (7 Replies)
Discussion started by: Pcushing
7 Replies
8. Shell Programming and Scripting
I have a file, not really a csv, but containing delineated data just the same. Lets call that file "raw_data.txt". It contains data in the format of company name:fein number like this:
first company name:123456789
second company name:987654321
what i need to do is read this file, apply... (11 Replies)
Discussion started by: FreddyG
11 Replies
9. Shell Programming and Scripting
Folks,
I have a bit of an issue trying to obtain some data from a csv file using PERL. I can sort the file and remove any duplicates leaving only 4 or 5 rows containing data. My problem is that the data contained in the original file contains a lot more columns and when I try ro run this script... (13 Replies)
Discussion started by: lodey
13 Replies
10. UNIX for Advanced & Expert Users
Hi
I have a CSV file with me in this format
Currency, USD, EUR,
USD, 1.00, 1.32,
EUR, 0.66, 1.00,
How do I transpose the file to get to the format below.
currency, currency, rate
USD, USD, 1.00
USD, EUR, 1.32
EUR, USD, 0.66
EUR, EUR, 1.00
Thanks for your help
We are using... (2 Replies)
Discussion started by: cdesiks
2 Replies
CSV2LATEX(1) General Commands Manual CSV2LATEX(1)
NAME
csv2latex -- convert a csv file into a LaTeX document
SYNOPSIS
csv2latex [--nohead] [--longtable] [--noescape] [--guess] [--separator c|s|t|p|l] [--block q|d|n] [--lines #] [--position l|c|r]
[--colorrows 0-1] [--reduce 1|2|3|4] [--repeatheader] [--nohlines] [--novlines] [file]
DESCRIPTION
This manual page documents the csv2latex program.
csv2latex is a program that reads a "comma separated values" (csv) file and outputs a LaTeX file with one or more tabular environments to
display the printable values of the csv file. The LaTeX code is flushed on the standard output.
So-called "comma separated values" files are common formats for exchanging two-dimensinal tables between programs such as spreadsheets edi-
tors, to represent almost any kind of data. By default, a csv file is made of printable data separated by commas (`,'), each comma repre-
senting a `cell' separator, and each line representing a row. By extension, cell separators can be represented by tabs if the comma is con-
sidered as printable data. Moreover, some non true csv files can be assumed as two-dimensional tables as well. In some circumstances, if
the printable data includes the cell separator of the exchange format, the latter can use a second extra character to embrace the printable
data into a block (e.g: quoted text). Thus, it is still possible to parse the file by using the block delimiter (used twice to embrace the
cell) instead of the separator.
csv2latex aims to parse various csv formats plus formats that fits into the above definiton, assuming the data is text, and to produce a
yet simple LaTeX file using the "tabular" environment for a table-style layout. Some options of output will also use macros provided by
extra LaTeX packages that are commonly included in the main LaTeX distributions.
OPTIONS
This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included
below.
-h --help
Show summary of options.
-v --version
Show version of program.
-n --nohead
Do not output the LaTeX document header. This is useful when the output is to be included as a separate file into the master
document.
-t --longtable
uses the 'longtable' package instead of the 'tabular' one. This is useful when the input is long, with --lines 0 option. This
option uses the extra `longtable' LaTeX package. If you also use --nohead option, do not forget to add the following line into
the header of your master document: "usepackage{longtable}".
-x --noescape
Do not escape TeX control characters from the input. This is useful when the input contains already TeX code.
-g --guess
Try to guess the csv format. This is useful when the input is not strictly a comma separated set of printable data. For exam-
ple, a line like %Foo, Bar%:%Wizz: Hey% may be parsed as "Foo, Bar" then "Wizz: Hey".
-s c|s|t|p|l --separator c|s|t|p|l
Set the given separator as cell separator of the csv format. `c' means a comma (default). `s' means a semicolon. `t' means a
tab. `p' means a space. `l' means a colon.
-b q|d|n --block q|d|n
Set the given block delimiter that embraces the printable data of the csv format. `q' means a simple quote. `d' means a double
quote. `n' means no quoting at all (default).
-l # --lines #
Force to output multiple tabulars, each having a limited number of lines. The given argument must be a POSITIVE INTEGER VALUE.
This is useful when the number of input rows is too big to fit into a single papersheet. A good average for a4 paper is about 40
lines (default). 0 means infinity (actualy about 2 Giga lines).
-p l|c|r --position l|c|r
Set the text position in all cells at once. This simply uses one of the three basic cell formating options of the LaTeX tabular
environment. `l' means left-aligned (default). `c' means centered. `r' means right-aligned.
-c 0-1 --colorrows 0-1
Alternate white/gray rows on the LaTeX output, having the given graylevel. The given argument must be a REAL NUMBER BETWEEN 0
AND 1. 0 means black while 1 means white. A nice looking value is 0.75 when printed on white paper. This option uses the extra
`colortbl' LaTeX package. If you also use --nohead option, do not forget to add the following line into the header of your mas-
ter document: "usepackage{colortbl}".
-r 1|2|3|4 --reduce 1|2|3|4
Reduce the size of the tabular and the font in the LaTeX output, given a reduction level. The given argument must be one of 1,
2, 3 or 4. The more the level is high, the more the tabular will appear small. This is useful to shrink the table width when
the printable data is made of very long text. This option uses the extra `relsize' LaTeX package. If you also use --nohead
option, do not forget to add the following line into the header of your master document: "usepackage{relsize}".
-z --nohlines
Do not output horizontal lines in the table(s).
-y --novlines
Do not output vertical lines in the table(s).
-e --repeatheader
Repeat the first row of the first table in every table. This is useful when the output is very long and separated in multiple
tables.
EXAMPLES
Create a PDF document with small text, alternate gray rows, 80 lines per table, from a guessed csv format of the january stats that my boss
created with his super point-and-click spreadsheet program (which could not generate a PDF output!).
csv2latex --guess --lines 80 --colorrows 0.75 --reduce 2 january_stats.csv > january_stats.tex && pdflatex january_stats.tex
Quickly preview a phonebook from a file formated as "Surname" "Name" "Phone" "Cellular":
csv2latex -s p -b d -l 42 phonebook-sorted.txt | latex
SEE ALSO
tex (1), latex (1).
CSV2LATEX(1)