Skip to content
Advertisement

Tag: csv

Split CSV file in bash into multiple files based on condition

My csv file has multiple rows of data and I want to split it into multiple files based on one attribute. SQL code with ORDER BY ID is triggered from beeline which creates single CSV. cat sql.csv “attr;attr;ID;attr” “data;data;XXXX;date” “data;data;XXXX;date” “data;data;YYYYY;date” “data;data;YYYYY;date” “data;data;BBBBB;date” “data;data;BBBBB;date” Desired result is to split once new ID is recognised and use that ID in filename.

Conditional append of strings on fields in a csv file

I am trying to convert a csv file like below with bash scripts. Headers and structures are always the same. Source csv file: Conditional values (will change depending on the requirements) Now I am trying to get the following result without the first row and values are now separated by spaces if each header matches those conditional values: I know

Recover informations from CSV files with my awk script

I have this CSV files : I create a little script that allow me to recover the informations from my csv and to place them like this : My script is : But the result is : Or I want : Can you tell me why my script doesn’t works and why floats are not taken into account ? Thank

Merge many csv files with similar names [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 4 years ago. Improve this question I have many csv files in a particular format like 1file1.csv

linux command to delete the last column of csv

How can I write a linux command to delete the last column of tab-delimited csv? Example input aaa bbb ccc ddd 111 222 333 444 Expected output aaa bbb ccc 111 222 333 Answer It is easy to remove the fist field instead of the last. So we reverse the content, remove the first field, and then revers it again.

jq array of hashes to csv

So I have a data source like this: I want to get output like this: Using a fake parameter seems like a hack and then needs to be clean up by sed to work. How do I do this with just jq. Answer Instead of trying to put literal newlines in your data, split the data into separate arrays (one

How to separate data from large tsv file based on conditions and write on another file using Linux command

I have a tsv file named userid-timestamp-artid-artname-traid-traname.tsv of more than 2 GB of size with the following data Consider the first input line: Where first column is userid i.e. user_000022, second column is timestamp i.e. 2007-08-26T20:11:33Z, third column is artid i.e. ede96d89-515f-4b00-9635-2c5‌​‌​f5a1746fb, fourth column is the artname i.e. The Aislers Set, fifth column is the traid i.e 9eed842d-5a1a-42c8-9788-0a11e818f35c and sixth

Bash: Parse CSV and edit cell values

I am new to bash scripting I have the following CSV Input Expected Output I need to check Location and Way and convert them to UpperCase – ABC, UP Day needs to be mon – Mon I need to do this for entire CSV. I need to correct the value and write all the fields on to CSV or edit

Join two csv files

csvfile1 csvfile2 expected output I would like to combine the columns longitude,latitude and timestamp of both the files. There are two longitudes and two latitudes in csvfile2. So i want to compare if it matches any one of the longitude-latitude pairs along with the timestamp. And the column name order is also different in both the files. Any help would

Advertisement