CSV Utility
About
Usage
Installation
Install csv_utility via cargo with the following command
or build it yourself by pulling the repo.
Using CSV Utility from the Command Line
Examples
In the following examples, the table below is used as the source.csv file.
| city | size | population |
|---|---|---|
| New York City | 783,8 | 8,399 |
| Washington, D.C. | 177 | 705.749 |
| Texas | 29.000.000 | |
| California | 423.970 | 39,51 |
| Los Angeles | 1.290,6 | 3.979.576 |
| San Francisco | ||
Map
In this example the content of source.csv gets mapped to the following header from dest.csv and saved to out.csv.
| stadt | einwohner | fläche |
|---|
Running the command above opens a user interface with the following options:
MapLet you map the columns from the source file to the destination file.Save mapping fileSaves the mapping created inMap.Save as new mapping fileSaves the mapping created inMapto a new mapping file.CancelCancels the command.Save and exitSaves the columns according to the mapping in the output file and exit afterwards.
The result looks like
| stadt | einwohner | fläche |
|---|---|---|
| New York City | 8,399 | 783,8 |
| Washington, D.C. | 705.749 | 177 |
| Texas | 29.000.000 | |
| California | 39,51 | 423.970 |
| Los Angeles | 3.979.576 | 1.290,6 |
| San Francisco | ||
rmer
Running the following command on source.csv
Gets us out.csv with the following content:
| city | size | population |
|---|---|---|
| New York City | 783,8 | 8,399 |
| Washington, D.C. | 177 | 705.749 |
| Texas | 29.000.000 | |
| California | 423.970 | 39,51 |
| Los Angeles | 1.290,6 | 3.979.576 |
| San Francisco |
rmwt
Running the following command on source.csv
Gets us out.csv with the following content:
| city | size | population |
|---|---|---|
| New York City | 783,8 | 8,399 |
| Washington, D.C. | 177 | 705.749 |
| Texas | 29.000.000 | |
| California | 423.970 | 39,51 |
| Los Angeles | 1.290,6 | 3.979.576 |
Using the 2 for -t the output file would look like this.
| city | size | population |
|---|---|---|
| New York City | 783,8 | 8,399 |
| Washington, D.C. | 177 | 705.749 |
| California | 423.970 | 39,51 |
| Los Angeles | 1.290,6 | 3.979.576 |
append
With append the -d file get appended to the -s file and written to the output file.
| city | size | population |
|---|---|---|
| New York City | 783,8 | 8,399 |
| Washington, D.C. | 177 | 705.749 |
| Texas | 29.000.000 | |
| California | 423.970 | 39,51 |
| Los Angeles | 1.290,6 | 3.979.576 |
| San Francisco | ||
| New York City | 783,8 | 8,399 |
| Washington, D.C. | 177 | 705.749 |
| Texas | 29.000.000 | |
| California | 423.970 | 39,51 |
| Los Angeles | 1.290,6 | 3.979.576 |
| San Francisco | ||
stats
The Stats command shows some information about the content of the csv file.