Skip to content

csvtool is an easy to use command-line tool to work with .CSV files.

License

Notifications You must be signed in to change notification settings

maroofi/csvtool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csvtool

Command-line utility to work with .CSV files in bash.

Installation:
Using PIP with Git (recommended):
pip3 install git+https://github.com/maroofi/csvtool.git
Using pypi (Not sure it's always updated):

I am not updating pypi package anymore. Always install it using Git method

pip3 install csvtool
Directly using Git repo:
git clone https://github.com/maroofi/csvtool.git

cd csvtool

python3 setup.py install --user

Note: To use it independetly as a command-line tool, make sure you have ~/.local/bin in $PATH variable.

  1. Change to your home directory by: cd $HOME
  2. Open the .bashrc file.
  3. Add the following line to the file.
export PATH=~/.local/bin/:$PATH
  1. Save the file and exit
  2. then use:
source .bashrc

Example:

csvtool -h

Show the long version of the help for more information.

Sample test.csv file:

Year Make Model Description Price
1997 Ford E350 "ac, abs, moon" 3000.00
1999 Chevy "Venture ""Extended Edition""" "" 4900.00
1999 Chevy "Venture ""Extended Edition, Very Large""" 5000.00
1996 Jeep Grand Cherokee "MUST SELL! air, moon roof, loaded" 4799.00
  1. Select all the 'Chevy' car and show the year, price and model:
csvtool -c 2 -s '^Chevy$' test.csv | csvtool --no-header -c 1,5,3

output:

Year,Price,Model
1999,4900.00,"Venture ""Extended Edition"""
1999,5000.00,"Venture ""Extended Edition, Very Large"""
  1. Select only year and name of the cars:
csvtool -c 1,2 test.csv

output:

Year,Make
1997,Ford
1999,Chevy
1999,Chevy
1996,Jeep

TODO LIST

  1. Add header to the output. ✔️
  2. Add replace command to replace some specific values.

About

csvtool is an easy to use command-line tool to work with .CSV files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages