Showing posts from August, 2020

Linux CSV Command Line Tool XSV

In this post, I will introduce an excellent command line tool XSV for the CSV file parsing and data manipulation. You can install the tool from github Let us begin the tutorial. If you are on Centos, following installation commands will work. yum install cargo cargo install xsv By default cargo installs it in /root/.cargo/bin/xsv If you are not root, you might have to set either alias or add the tool in your bash PATH. alias xsv=/root/.cargo/bin/xsv As an example, I would look at the stocks data which I downloaded from Yahoo Finance for the Apple stock. Ok let us first look at our data. Read Csv file using Xsv Ok, now let us try using the Xsv command "xsv table". Xsv table would show the data in nice tabular form. Instead of Linux 'head -2' command, we can also use Xsv slice command. Xsv slice command takes index number to display a particular row. Let us say, we want to print the 2nd row. Note index starts from 0 which means data at