Questions tagged [csv]

A comma-separated values file (CSV) stores tabular data in plain-text form.

Filter by
Sorted by
Tagged with
10
votes
1answer
607 views

Convert a .txt file in a .csv with a row every 3 lines

Let's say I have a txt file like this: Mario mario@me.com +399038259953 Luigi luigi@live.com +395902385093 Yoshi yoshi@yahoo.com +81293565291 [and so on for 300 lines...] How do I make a .ods (or ....
0
votes
2answers
196 views

sorting a csv file with 3 columns

I am trying to sort a csv file containing 3 values. The first one is the one that matters. It contains many times the number 1, 2, 3, 4 etc etc. But each number doesnt appear the same number of times ...
0
votes
1answer
278 views

Individual attachments in mail merge from thunderbird

I am trying to send multiple emails with unique fields from thunderbird with mail merge addon in ubuntu. How to add individual attachments using this method? I have tried adding a separate field ...
1
vote
0answers
561 views

Adding multiple CSV files into one .XLSX file having different sheets using python

I have many CSV files which I want to add in a single excel file with each sheet having single CSV file and also I want name of CSV file at the top. Please help me with python code preferably.
1
vote
1answer
327 views

Split CSV file based on column values and number of lines

I must work with data from a huge CSV file in a format like this one. The file is very huge (~200MB) and my PC is having difficulties with it, so I would like to split the file in smaller ones easier ...
1
vote
1answer
65 views

awk adding up two rows if the rows have a matching name

I am trying to take a csv file that looks like customerID,firstname,lastname,charge 5efc522,Romo,goodrick,37.89 4a7f057,jeny,vel,38.39 5efc522,Romo,goodrick,39.00 and make it into firstname,lastname,...
0
votes
1answer
566 views

Append specific output from ubuntu terminal in a csv file

Above is the output of my command. I want to save the highlighted output into a csv file in append mode. They should be in the same row but in different columns. My final csv file should be like this ...
0
votes
1answer
2k views

Create a CSV file from a TXT file

How do I create a CSV file from a TXT file as per the following example? Thanks. TXT file: This is line number one This is line number two with extra words This is line number three with even more ...
6
votes
1answer
3k views

Trying to create a CSV file from a text file in Ubuntu

I have a text file that contains passwords and their respective hashes that is formatted as such: 'plaintext password' 'SHA256 hash' 'SHA3-512 hash' This format continues for several more passwords. ...
0
votes
1answer
37 views

How do I use a shell script to keep only the last populated value for each month in a CSV?

I have a csv file which gets updated by a cron daily and looks something like this: Date,Value 01/11/2019,123 02/11/2019,456 03/11/2019,789 ... 31/01/2020,123 01/02/2020,456 02/02/2020,789 03/02/2020,...
2
votes
4answers
1k views

Selecting rows from csv for a particular day in bash script

I have a CSV file called test.csv containing these values : A,table,20191229 16:41:58 B,table2,20191222 16:41:58 C,table3,20191223 16:40:58 D,table4,20191228 16:41:58 E,table5,20191227 16:41:...
1
vote
1answer
67 views

How to add new columns to CSVs with the same text in all lines

This a sample of my input file: 22/12/1999,conductivity,42,uS/cm 06/01/2000,conductivity,22,uS/cm 26/01/2000,conductivity,26,uS/cm 09/02/2000,conductivity,32,uS/cm 23/02/2000,conductivity,33,uS/cm I ...
3
votes
1answer
2k views

How to find the delimiter used in a txt file and convert it to comma separated csv?

I have a txt file that has either tab or space delimiter. I need to convert it to csv. How do you suggest to do so using command line? $ perl -F"//" -nlae 'for (@F) {$a{$_}++};for (keys %a){print $_ ...
3
votes
0answers
1k views

Remove last character of a text file

How may I remove the last character of a text file in the shell without an unwanted final nextline? Can you believe I tried more than 3 hours... Actually, only this works : printf '%s\n' '$' 's/.$//...
2
votes
1answer
103 views

How to copy files containing a specific phrase to another directory?

I have a huge directory with log-files and want to move files WITH a specific "phrase" in it. i.e. log1.csv ------ containing word "xzy" log2.csv ------ containing word "abc" log3.csv ------ ...
0
votes
0answers
140 views

Replace string with another string in bash script?

I have a .csv sheet with 3 columns and 'n' number of rows. Column1: It defines the name of the Rule. Column2: This is the schema line present in all the test files. Column3: This is the line which ...
0
votes
1answer
50 views

How to rename the exisitng cell names based on number of their occurnaces in a particular column?

I have a column in my excel as below: REF --------- BV1013_1 BV1013_1 BV1013_2 BV1013_2 BV1026 BV1040 BV1040 BV1041 BV1041 BV1042 BV1042 Desired OUTPUT: Some of the cell values/names are same at ...
4
votes
4answers
1k views

How to make a Bash script to change the format of a date in a CSV file

I've got a series of CSV files whose second field is dates: R.OUSE BOURTON MILL,2000-03-22T14:50:00,Ammoniacal Nitrogen as N,0.03,mg/l How can I change the date format into DD/MM/YYYY for all files? ...
1
vote
0answers
375 views

JSON TO CSV WITH JQ PLAY ERROR

I am new to this. Please forgive me. I am trying to make a CSV file from JSON data. I got far but my data is complex. I am using this line: jq --raw-output '(map(keys) | add | unique) as $cols | map(. ...
0
votes
2answers
112 views

Compare 2 cols; when 1st col > 2nd col, remove 2nd col

How can I compare 2 cols in csv file, divided by ,, and cols contains quotes " when , is present in generated col, and when 2nd col > 1st col, then remove 2nd (last) col. I did something similar, ...
0
votes
1answer
78 views

CSV flies lost when transferred

I changed my OS from Linux to Windows 10 a week back. I saved a few CSV files and some code. After clearing the hard drive and making the switch, I realized that the CSV files were saved in this ...
1
vote
1answer
767 views

How to name the columns in BASH?

I am writing output of 6 UNIX variables into a CSV file. Yes,now I have a CSV file with all the columns that I want.But, I want to use those variable names as column Name/ column Header. How can we ...
-1
votes
1answer
5k views

How to compare two rows in a csv file? [closed]

I've a data.csv file which looks as follows. -1.95e+01 -2.30e-01 -2.56e-01 4.44e+01 -1.95e+01 -2.30e-01 -7.68e-01 4.48e+01 -2.00e+01 -2.30e-01 -2.56e-01 3.41e+01 -2.00e+01 -2.30e-...
1
vote
2answers
2k views

AWK: Sum columns, write them into a “final” row

My CSV looks like this A 5 3 B 3 1 ... I need to get the sum of all columns and add those to a new line in the CSV so it becomes A 5 3 B 3 1 SUM 8 4 I was able to print the sum ...
0
votes
1answer
329 views

System has 32 GB ram but maximum usuage is up to 6 GB

I am using Ubuntu 16.04 (64 bit) and my system has 32 GB RAM. When I run a python (64 bit) program on it, I get a "MemoryError". the output to free -m is: total used free ...
1
vote
3answers
423 views

CSV to TSV without replacing commas within quotes

All the CSV to TSV tutorials are suggesting a simple: tr ',' '\t' though some CSVs look like this: 1,310,"IntAct,PINA" in which case I would like to keep "IntAct,PINA": 1 310 "IntAct,PINA" How ...
0
votes
2answers
50 views

combine the rows to file3 only if the date is present in both files in sorted order of dates and month

My problem is I need to consider the rows to file3 only if the date is present in both files Consider file1.csv dtime,c,y,s 2015-02-01,395,396,g 2015-02-02,395,397,g 2015-02-03,395,397,g This file2....
5
votes
1answer
232 views

Changing second column in csv conditionally

I have a csv file that looks like: data/train/4/36280.png,four data/train/2/10317.png,two data/train/2/57890.png,two data/train/1/53448.png,one data/train/8/58233.png,eight data/train/4/23599.png,...
3
votes
2answers
2k views

MySQL importing CSV files really slow

I am trying to import CSV files into a table, but it has been very slow. I have about 1000 files with a file size of 40 MB each. Whenever I try to import it, I can see with for example MySQL workbench ...
4
votes
1answer
2k views

Libre Office Calc keeps removing quotes

I am opening a .csv file using LibreOffice Calc. However, no matter the format I choose to save the file with after modifying it (either ODF or CSV) for some columns that contained quoted values, the ...
3
votes
2answers
9k views

From XML to CSV with command line

if I have a XML file on local disk, which command is need to convert file in CSV? And from XLSX or XLS to CVS? Thanks.
3
votes
4answers
2k views

Move specific column from csv file in front (select column by name)

Consider this data: #!/usr/bin/env bash cat > example_file.txt <<EOL group, value, price 1, 3.21, 3.21 1, 3.42, 4.11 1, 3.5, 1.22 2, 4.1, 9.2 2, 4.2, 2.11 EOL I want to move the 'value' ...
0
votes
0answers
570 views

csvkit - command line csv viewer and Ubuntu 18.04

Has anyone tried using csvkit in Ubuntu 18.04. I use the command csvlook to view csv files from command line. It used to work in other Ubuntu versions but in 18.04 I get error like the following when ...
0
votes
1answer
3k views

Convert output of shell script to .csv

I want to convert the output of the below patchhistory.sh shell script to csv, so that I can get the information in column format like this: servername patch history ...
2
votes
1answer
737 views

script for csvtool for replacing columns

I want to replace certian columns in a csv file into another and i found this in the csvtoll man page. Which replaces column 1 in the first file with the column 1 in the second file. csvtool ...
1
vote
2answers
79 views

Why Extented Regular expression works on command line input but not when reading from a file

Using Windows 10 developer mode. My regular expression works perfectly when I execute in command prompt. Substitutes mm/dd/yyyy hh:mm to yyyy-mm-dd within a string delimited by comma. It does not ...
3
votes
1answer
1k views

How to combine multiple CSV files to one ods file on the command line. One sheet per original file

How to combine multiple CSV files to one ods file, one sheet per file. I have ten CSV files and I would like to combine them to one ods file comprised of ten sheets, one per original CSV. This should ...
0
votes
2answers
1k views

Manipulate csv file using bash script or python, converting certain columns into rows

I have a csv file with 6 columns. I want to write a script using Python or Bash so that I can generate a new file, maybe a txt file, where for each row the first three columns remain the same (that is ...
1
vote
2answers
2k views

Delete multiple rows in csv file

I'm working on this assignment to delete rows from a CSV file with different customers. I've figured out how to delete one specific customer by using this code: delete() { awk -F "\"*;\"*" '$1 != '$...
2
votes
1answer
9k views

view the column names for CSV file?

i have a CSV file i want to get the columns name for each column sample : how can i do that with awk or sed or grep ??
4
votes
1answer
3k views

column: line too long error

I'm trying to view the first 5 columns from the terminal following this guide here: https://chrisjean.com/view-csv-data-from-the-command-line/ When I run cat rangelast.csv | sed -e 's/,,/, ,/g' | ...
7
votes
3answers
4k views

How to split an ODS spreadsheet file into csv files per sheet on the terminal?

I would like to split a spreadsheet (ods or xlsx) into multiple csv files, one for each sheet in the spreadsheet. I would like to do this without launching a graphical app and preferably in a one ...
3
votes
3answers
429 views

Converting numbers in a CSV file to their corresponding URLs

I have a CSV file with two columns (and a header) where each of its elements includes any number between 0 to 199. I want to convert these to their corresponding URLs. Here is an example: 41,51 ...
1
vote
1answer
668 views

How to compare and replace the value at particular location with awk

I want to compare two csv files with one common column and then replace the data from first file to second file at particular location. file1.csv: "id","name","marks","subject","result" "1","a","","...
1
vote
1answer
921 views

How to copy iphone contacts into a csv file

I want to copy my contacts in a csv file and then later on I want to use them with another icloud account by importing the contacts. I am using ubuntu version 17.10,mobile iphone se Can anyone help me ...
2
votes
0answers
1k views

How can I assign a column to represent the x axis values in libre office calc?

Currently my attempt at making a chart looks like this: The goal, nonetheless Is that subdivisions, should be the x axis and not a series of data entries in the chart. I have looked it up but I am ...
3
votes
2answers
196 views

CSV: concatenate more line data

I have this file1.csv: A,dog cat horse cow B,goat deer fish A,deer goat C,dog cat C,goat I need to merge join the similar lines (es. A and C): A,dog cat horse cow deer goat B,goat deer fish C,...
1
vote
1answer
702 views

Commas from csv only partially imported in Libreoffice Calc

I have a CSV here, generated using Rstudio (front-end for R). When I open it with Libreoffice Calc, the preview in the Text import dialog correctly displays the numbers in the last two columns. There ...
0
votes
2answers
59 views

processing lots of images which have their names stored in a csv file from terminal

How can I copy all the images in the second column of a CSV file and put them to a new folder named images? It has about 300k images so I wonder if there is a fast way to this (like I have 12 ...
10
votes
4answers
7k views

Convert .xls/.xlsx spreadsheets to multiple .csv's based on a list

I need to convert all sheets of a single .xls/.xlsx file to a .csv. This will be done on all .xls files in all directories and sub-directories (recursively). Step 1: Get the sheetnames of all .xls ...