10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
im using the code below to monitor a file:
gawk '{
a += gsub("(^| )accepted( |$)", "&")
a += gsub("(^| )open database( |$)", "&")
} END {
for (i in a)
printf("%s=%s\n", i, a)
}' /var/log/syslog
the code is searching the syslog file for the string "accepted" and "open... (2 Replies)
Discussion started by: SkySmart
2 Replies
2. Shell Programming and Scripting
Hi Experts ,
I need your help to collect the complete data between two time frame from the log files, when I try awk it's collecting the data only which is printed with time stamp
for example, awk works well from "16:00 to 17:30" but its not collecting <line*> "from 17:30 to 18:00"
... (8 Replies)
Discussion started by: zenkarthi
8 Replies
3. Shell Programming and Scripting
Hi everyone,
I got a data frame like the one below and and would like to do the following:
Ignore the first 3 rows and check in all following rows the second position. If the value is >500, subtract 100.
Example DF:
ABC 22 DE 12
BCD 223 GH 12
EFG 2104 DH ... (4 Replies)
Discussion started by: TuAd
4 Replies
4. UNIX for Dummies Questions & Answers
I know uniq exists, but am not sure how to remove repeating lines when they are groups of two different lines repeating themselves, without using sort. I need them to be sorted in the original order, just to remove repeats.
cd /media/AUDIO/WAVE/9780743518673/mp3
~/Desktop/mp3-to-m4b... (1 Reply)
Discussion started by: glev2005
1 Replies
5. Shell Programming and Scripting
I have the following data:
01:00:00 29 10 20 41
01:20:00 18 6 34 42
01:40:00 28 5 24 43
02:00:01 11 7 8 74
02:20:01 19 15 12 54
02:40:01 1 4 0 95
03:00:01 1... (6 Replies)
Discussion started by: BeefStu
6 Replies
6. UNIX for Dummies Questions & Answers
I want to extract the last rows of a data file, similar to that one below:
C1 xxx
C2 rrr
C3 ttt
....
Cn-1 hhh
Cn bbb
C1 yyy
C2 sss
C3 uuu
...
Cn-1 iii
Cn ccc
...
I just want to extract the final rows between C1 and Cn at each data file. n is not a constant,... (2 Replies)
Discussion started by: natasha
2 Replies
7. Shell Programming and Scripting
Hello,
I have file to work with. It has 5 columns. The first three, altogether, constitutes the position. The 4th column contains some values for downstream analysis and the fifth column contains some values that I want to add to 4th column (only if they happen to be in the same position).
My... (5 Replies)
Discussion started by: menenuh
5 Replies
8. UNIX for Advanced & Expert Users
Hi
I have a requirement as follows. My Input file is as follows.
COL1,COL2,COL3,COL4,COL5
987,2,3~7~5,400~468~598,0005~4687~5980
1111,2,2~7,400~468,0005~897
Expected OUTPUT
============
COL1,COL2,COL3,COL4,COL5
987,2,3,400,0005
987,2,7,468,4687
987,2,5,598,5980
1111,2,2,400,0005... (6 Replies)
Discussion started by: tkbharani
6 Replies
9. Shell Programming and Scripting
Hi,
i have a file with contents like below ( any number of entries can be there)
111
222
333
444
555
i need to make another file with single line like below:
111,222,333,444,555 (without ending , )
TIA
Prvn (8 Replies)
Discussion started by: prvnrk
8 Replies
10. UNIX for Dummies Questions & Answers
Can someone help me with the following 2 objectives?
1) The following command is just an example. It gets a list of all print jobs. From there I am trying to extract the printer name. It works with the following command:
lpstat -W "completed" -o | awk -F- '{ print $1}'
Problem is, I want... (6 Replies)
Discussion started by: TheCrunge
6 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)