Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago. Improve this question So i have a file1.dat with indexes i need to check (one by line) and a file2.csv file where i
Tag: csv
How to export daily disk space usage?
I am new to scripting. Is it possible to export the disk space usage of a linux server to an excel shell(.csv) sheet daily ? If so, what will be the scripting for that? Answer Use awk to parse df result: Assuming ; is your csv separator, then: gives: In a full script with the date:
Subtract a constant number from a column
I have two large files (~10GB) as follows: file1.csv file2.csv I want to subtract 1 from the “id” columns of these files: file1_updated.csv file2_updated.csv I have tried awk ‘{print ($1 – 1) “,” $0}’ file2.csv, but did not get the correct result: Answer You’ve added an extra column in your attempt. Instead set your first field $1 to $1-1: That
Bash: transform key-value lines to CSV format [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 years ago. Improve this question Editor’s note: I’ve clarified the problem definition, because I think the problem is an interesting one, and this question deserves to be reopened. I’ve got
linux sed reads whole file when only editing first line
I am currently working with CSV files that can be 10’s of GB in size, and need to edit the headers dynamically depending on the use case. For this I am using: which has the desired effect of only editing the headers, but can take upwards of 10 seconds to complete. I imagine this is because the whole file is
Join Two csv file to one Csv file Based matching Column
I have 2 csv file, first.csv secound.csv : I need to join this two csv file , if name are matching then, “Text” filed to add in first.csv file. output.csv Suggest me how to do this in php or linux cmd. Answer This should work.
Specify source line from csv when calling up/creating an array
I have a csv with data such as: I’ve written some code to turn each field into a variable, and also to create an array out of each word in field 2 (f2): My problem is now, because the file contains multiple lines I need some way of naming each array according to the line of data it was created
Get specific column from CSV in Bash script
I have a csv with nearly a hundred of column. I am writing a bash script to get only few of those column. CSV: I did some research and found this: But it requires to put ALL the column (92 in my case…) I can’t select want I want. So I try another solution: It cannot work because of the
Bash – one-liner echo with delimiter
So my sample code so far looks like this: I want to be able to echo it out to make it look like the following: But the problem is that when I tried using AWK, sed, or IFS they also use n as delimiters which I don’t want that to happen as the text gets all messed up. Is there
Replace characters in specific columns only (CSV)
I have data like this: It has dot . as decimal separator but I need to use , instead. Desired data: I tried using Sed. With sed -i ‘s/./,/g’ myfile.csv I could replace all dots with commas but would destroy dates on the fourth column. How can I change dots to commas in elsewhere but leave the fourth column as