Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Tab Delimiter to csv in python:perl Post 303046350 by RudiC on Friday 1st of May 2020 03:06:10 PM
Old 05-01-2020
Redirection works identical for input as well as for output. Try
Code:
$ mv /tmp/new_file /tmp/old_file
$ while read product id features
     do    printf "${product}, %s\n" ${features%#*}
     done < Check_File >/tmp/new_file

These 2 Users Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cutting a tab delimiter file

I have a 30 column tab delimited record file. I need to extract the first 10column. The following command to cut was not working cut -f 1-10 -d "\t" filename. Could any one keep on this . Thanks in Advance (4 Replies)
Discussion started by: vinod.thayil
4 Replies

2. Shell Programming and Scripting

append data in a file by using tab delimiter

Hi, I need to append the data in to a file by using tab delimiter. eg: echo "Data1" >> filename.txt echo "\t" >> filename.txt (its not working) echo "Data2" >> filename.txt. the result sould be like this. Data1 Data2 (6 Replies)
Discussion started by: Sharmila_P
6 Replies

3. UNIX for Advanced & Expert Users

how to search delimiter tab in a line and replace it

hi every one plz help me i want to search for a line contains tabspace This is a line The should be changed see the above line is seperated with tab space i want to replace that tab space in to # as This is a line#The should be changed i have tried with... (4 Replies)
Discussion started by: kkraja
4 Replies

4. UNIX for Dummies Questions & Answers

Delimiter: Tab or Space?

Hello, Is there a direct command to check if the delimiter in your file is a tab or a space? And how can they be converted from one to another. Thanks, G (4 Replies)
Discussion started by: Gussifinknottle
4 Replies

5. Shell Programming and Scripting

Selecting Specific Columns and Insert the delimiter TAB

Hi, I am writing a Perl Script for the below : I have a data file that consists of the header information which is 231 Lines and the footer information as 4 lines. The total number of line including the header and footer 1.2 Million with Pipe Delimited file. For example: Header Information:... (4 Replies)
Discussion started by: filter
4 Replies

6. UNIX for Dummies Questions & Answers

set output delimiter as tab in cut command

I can not make it work, it prints \t rather than introduce tabs. cut -d "," -f 4,8 Samples.csv --output-delimiter="\t" | sort > out Since I am running this command within a shell script, I tried manually inserting tab in this command, still does not work. I am using bash shell Suggestions... (8 Replies)
Discussion started by: analyst
8 Replies

7. UNIX for Dummies Questions & Answers

Making a Tab delimiter file to Comma

How can i make a tab delimiter file to a comma delimiter??? (13 Replies)
Discussion started by: saggiboy10
13 Replies

8. Shell Programming and Scripting

Compare two tab-delimiter files

Hi, I have two files like: file1 chr1 40 chr1 50 chr2 10 chr2 60 file2 chr1 30 chr1 50 chr2 15 chr2 20 and want to get the difference of column 2 when column 1 is the same in both files. (4 Replies)
Discussion started by: linseyr
4 Replies

9. Shell Programming and Scripting

CSV Delimiter Settings

Hi All, I am really new to Shell Scripting and would appreciate any help here. I have a script that runs throguh a cron job on a daily basis, problem is when the file is attached and e-mailed, it uses a comma delimiter to seperate fields. How can I prevent the script from using a comma... (2 Replies)
Discussion started by: SalientAnimal
2 Replies

10. Shell Programming and Scripting

Perl Code to change file delimiter (passed as argument) to bar delimiter

Hi, Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters. Any help would... (2 Replies)
Discussion started by: JPB1977
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)
All times are GMT -4. The time now is 04:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy