All Questions
14 questions
0
votes
1
answer
370
views
Process CSV file through command line: Remove only middle rows between consecutive row entries if consecutive entries have the same 2nd column value
I have a CSV file with only 2 columns (but lots of rows) and the occasional irregular row which always starts with an asterisk (*) character and may span more than two columns. Using just the Linux ...
-1
votes
2
answers
100
views
How I can extract just some fields from a CSV line of text
I need help to find out a way to extract specific information of the lines below using Linux commands.
391,(INSIDE-A),to,(OUTSIDE-A),source,static,SRV_I_N1909,SRV_NAT_I_N1909,destination,static,...
2
votes
1
answer
35
views
Layout tab/spaces [closed]
I've read this thread https://unix.stackexchange.com/a/7718/256195, that only if var doesn't contain any tab/spaces but in my case it does contain spaces, like below example:
"this is a test" ...
2
votes
1
answer
588
views
Bash- txt to column [closed]
I need to merge three txt files into one csv file, in which the first txt file goes to the first column, the second txt file goes to the second column, and the third txt to the third column.
The ...
2
votes
1
answer
1k
views
Concatenate CSV with some shared columns
I have two large files ~9GB. CSV File 1 has columns A, B, C, D, E and CSV File 2 has columns B, C, F, G. The desired output is A, B, C, D, E, F, G. All I have been able to find is joining on similar ...
1
vote
3
answers
1k
views
Selecting rows in a CSV file based on column value that contains an embedded comma
I have a CSV file (CSV UTF-8 (Comma delimited) (.csv)) with 5 columns: customer data, customer first name, customer email, cancel reason, cancel reason comments
How would I filter the rows that have "...
4
votes
2
answers
4k
views
How to replace commas with white spaces in a csv, but inserting a different number of space after each column?
I have a file in the following format:
s1,23,789
s2,25,689
and I would like to transform it into a file in the following format:
s1 23 789
s2 25 689
i.e 6 white spaces between the ...
0
votes
1
answer
128
views
Transpose CSV file by the value of a column
Input:
X Y
1 11
1 12
2 21
2 22
Desired Output:
11 12
21 22
I want to transpose the CSV file by the value of column 1. In this example, for X = 1, transpose (11, 12)^T to (11, 12); for X = 2, ...
3
votes
2
answers
1k
views
Processing table with comma separated values in different columns
I'm trying to do the following for a while but without success.
The data I received has comma separated values in each separate columns. The first value in column 6 before the comma is always related ...
-5
votes
2
answers
2k
views
Merge two csvfiles by column header
I have two csv files:
success.csv
"ID","Legacy ID","Field1", "Field2"
1,1111,google,news
2,2222,yahoo,news
error.csv
"Legacy ID","Field1","Field2","Message"
3333,aol,news,"Failed to upload data" ...
15
votes
6
answers
14k
views
Create an ASCII art table from tabular data
Given perhaps comma- or tab-delimited input, I'd like to present a series of appropriately padded columns to stdout, so I can easily scan columnar information which would otherwise present rather ...
4
votes
1
answer
4k
views
Regarding generating intersection and union of two csv files
I have two csv files, there are some overlap columns between these two files. Assume one file is called as A.csv and another is called as B.csv. The intersection of A and B is called as C.
I would ...
50
votes
7
answers
36k
views
command to layout tab separated list nicely
Sometimes, I'm getting as an input tab separated list, which is not quite aligned, for instance
var1 var2 var3
var_with_long_name_which_ruins_alignment var2 var3
Is there an easy way to render ...
89
votes
29
answers
68k
views
Is there a robust command line tool for processing csv files?
I work with CSV files and sometimes need to quickly check the contents of a row or column from the command line. In many cases cut, head, tail, and friends will do the job; however, cut cannot easily ...