Spiga

How To Sort The CSV File

How To Sort The CSV File:
Always we came across at some point where we want to sort the data, or we want to compare similar kind of data. So, in this post, we will focus on some of the quick ways to sort the data of the CSV file. Windows provide the SORT command, and using that command we can sort the data of the files.
Sorting Using Windows SORT Command
1)      You can use the sort command to sort the files. In the command prompt, type following:
a.       Sort  Input_filename  : This will sort the file and will display the output on the console. This will sort the file on the basis of first column. Let’s suppose your input is :
Input:
1              g              k
3              f              d
2              c              a
                                             Output will be:
sort Book.csv
1,g,k
2,c,a
3,f,d
b.      Sort  Input filename Output Filename : This will sort the input file data and will store the result in the OutputFile.
Example:     sort Book.csv  outputBook.csv
c.       Sort  Input_filename Output_Filename /+Column_Number: This will sort the file on the basis of column number. If we provide column number as 2, it will sort the file on the basis of column 2nd column. E.g.:
sort Book.csv /+2
2,c,a
3,f,d
1,g,k
2)      You can write the Customized java written program also to sort as per requirement. In the next post we will see the customized Java Program to sort the files. This one is my favourite.
3)      There are several software’s available in the market for this and as well as other purposes.

1 comments:

  we24support

July 11, 2012 at 12:26 PM

Nice Blog! Informative Content for Technical knowledge. Thanks for sharing your views. For Computer Software support/services visit this link. They provide 24x7 online support.
Fix your Problem by We24support