pip3 install git+https://github.com/maroofi/csvtool.git
I am not updating pypi package anymore. Always install it using Git method
pip3 install csvtool
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.
- Change to your home directory by: cd $HOME
- Open the .bashrc file.
- Add the following line to the file.
export PATH=~/.local/bin/:$PATH
- Save the file and exit
- then use:
source .bashrc
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 |
- 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"""
- 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
Add header to the output.✔️- Add replace command to replace some specific values.