extracting column and sorting csv data alphabetically

extracting column and sorting csv data alphabetically

hi

here is my code and csv data save it as country.csv file

*Australia;AU;1.5 Thaialnd;TH;1.6 India;IN;1.7 Malaysia;ML;1.8 Japan;JP;1.9 Korea;KO;1.10 Bangladesh;BD;1.11 China;CN;1.12 Chile;CH;1.13 Brazil;BR;1.14 Portugal;PG;1.15 Netherlands;NL;1.16 Belgium;BE;1.17 Poland;PO;1.18 England;GB;1.19 Ireland;IR;1.20 Scotland;EN;1.21*

public class Csv {

public static void main(String[] args) throws Exception {

    String csv = "d:\\country.csv";
    String line = "";
    String splitby = ";";
    String s;
    BufferedReader br = new BufferedReader(new FileReader(csv));
    while ((line = br.readLine()) != null) {
        String[] country = line.split(splitby);
        for (int i = 0; i < country.length - 1; i++) {

            BufferedWriter bw = new BufferedWriter(new FileWriter(
                    "d:\\output.txt", true));

            s = country[i];
            System.out.println(country[i]);
            bw.write(s);
            bw.newLine();
            bw.flush();

            bw.close();

        }

    }
    br.close();
}

}

View Answers









Related Tutorials/Questions & Answers:
extracting column and sorting csv data alphabetically
extracting column and sorting csv data alphabetically  hi here is my code and csv data save it as country.csv file *Australia;AU;1.5 Thaialnd;TH...* public class Csv { public static void main(String[] args) throws Exception
Alphabetically sorting order
Alphabetically sorting order  Write a java program that takes a list of words from the command line and prints out the arguments in an alphabetically sorted order   Hi Friend, Try the following code: import
Advertisements
Sorting Country names alphabetically
Sorting Country names alphabetically  Hello, I have a list of country names in an array. I need a jsp code which will sort me the country names in an alphaberical order. It would be more useful when I get the coding using
sorting and storing data
sorting and storing data   sorting and storing data in UITableView
sorting
sorting   write a program to arrange sorting in rows,column and diagonal
HTML Form data into .CSV?
HTML Form data into .CSV?  how to store data from html form to csvfile in java
sorting
sorting  write to a program to arrange the sorting in rows, column and digonal
Read text file to 2D array and sorting the second column
Read text file to 2D array and sorting the second column  we found.... when exams conducted fast 4 times.The first column is the student name and the second column is marks in tests.What we need to find is which student marks
ADT ,data structure (ArrayList), sorting
ADT ,data structure (ArrayList), sorting  Write a program to calculate a bonus for 10 employees of WAFA Supermarket. The program consists of an abstract class Employee. Each employee contains IC number, name, basicSalary
How to display the data column on jsp
How to display the data column on jsp  My requirements: Display total error count of error description of each database server (column wise). like... .. in table of each database having two columns: description, error. but data
Sorting
Sorting  can any help me know which sorting algorithm java uses for sorting collection and arrays
Exporting data from mysql into csv using jsp
Exporting data from mysql into csv using jsp  Hi friends.... I want to export the data from mysql to csv file using... i am having 30 columns in my... in csv file..if i export, am getting the csv file with all data in one row
sorting
sorting  how to do sorting without using bubble sort,selection sort
insert data 50 row *column into 300 row *column by using xls sheet data (50 row *column) are given in xls sheet
insert data 50 row *column into 300 row *column by using xls sheet data (50 row *column) are given in xls sheet   1- there are matrix of data with 300 row and 300 column,this is master table we have input data 50 row and 50
Exporting data from mysql to csv file
Exporting data from mysql to csv file  Hi friends.... I want to export the data from mysql to csv file... i am having 30 columns in my database.. Eg- text1,text2,text3,....,upto text30... i want to export this data in csv file
group by sorting
group by sorting  group by sorting of data in SQL
sorting and filtering the displayed table data using jsp and xml
sorting and filtering the displayed table data using jsp and xml  I have created a xml file and a jsp file, which uses DOM parser to display the content of xml file in web page. Now I would like to sort and filter those data
How to copy existing column along with data and column name into another existing table
How to copy existing column along with data and column name into another existing table  i want to copy the existing column along with data... way to copy both column name and data
create dropdown cell in csv or excell from mysql data in php
create dropdown cell in csv or excell from mysql data in php  Hello sir i want to create drodown cell in csv from mysql data is this is possible or not? if this is posible please share answer or reference link Thanks
Read specific column data from text file in java
Read specific column data from text file in java  My question is if my text file contain 15 columns and i want read specific column data from that text file then what code i should do
Sorting data in a jsp using a servlet while implementing comparable - JSP-Servlet
Sorting data in a jsp using a servlet while implementing comparable  Hi Sorry for being not so clear before. I have 3 records in my database. I... it for sorting. Bellow is its code: /* * To change this template, choose Tools
how to change a column data in a every row in a text file in java
how to change a column data in a every row in a text file in java   i have text file like this 11,6,13/9/14,1287605778,89... column in every row ie. account number to some text in a text file in java could
How to save form data to a csv file using jquery or ajax
How to save form data to a csv file using jquery or ajax  Please let...=data.responseText; Now the problem is ,i should write form data to a csv file using ajax... this. i am able to read the csv file using this code if (window.XMLHttpRequest
I am trying to create domains for column attributes of my data dictionary?
I am trying to create domains for column attributes of my data dictionary?  Please provide me with the best possible solution. I already have the fields and there data types in a table and then the field values in another table
Sorting in Java
Sorting in Java  Sorting in Java
Extracting equation from any document
Extracting equation from any document  how can i extract equation from any word document?   Hello Friend, If you want to extract data from the word file, then visit the following link: Extract data from word document
Expport data into CSV File using JDBC in Servlet
;JdbcCsvFile.java" to export data from database in to CSV file. Brief... .style1 { font-weight: bold; } Expport data into CSV File using JDBC in Servlet   
Export data into CSV File using Servlet
Export data into CSV File using Servlet  ... to Export data into  CSV file using Servlet. We have created  file "JdbcCsvFile.java" to export data from this .java file.. Brief
importing CSV data into Database in java when the no of columns are known using javacsv
importing CSV data into Database in java when the no of columns are known using javacsv   I have imported CSV data into postgres Database in java... that if the no of columns in the csv are not known then also i should be able to import
Mysql Alter Column Size
Mysql Alter Column Size       Mysql Alter Column Size is used to change the data size... Data type of Table named employees after altering column size
convert excel file data into different locales while converting exclile file to csv file
convert excel file data into different locales while converting exclile file to csv file   can any one provide the code for how to convert excel file data into different locales while converting exclile file to csv file
how to save html form data into .csv file using only jsp.
how to save html form data into .csv file using only jsp.  Dear all, I am developing a website only using jsp and html. i need to save the form data into a .csv file using jsp. can anyone give me any sample solution or tutorial
CSV tables
CSV tables  hello, What are CSV tables?   hii,ADS_TO_REPLACE_1 CSV Tables cannot be indexed.CSV Tables are the special tables, data for which is saved into comma-separated values files
Extracting variable from jsp
Extracting variable from jsp  how to Write a java program which will be extracting the variables and putting them in an excel format?   ...(); out.println("Data is saved in excel file."); }catch ( Exception ex ){ } %>
Html Parsing Extracting Content
Html Parsing Extracting Content  Hello i need to parse html and search for a string and get its attributes.For example 'xxx' is my search string. i search html page and find xxx css attributes.Java,php,javascript is okey thank
Imp-HTML Table Sorting
of HTML table sorting where sorting happenes whenever user clicks on column header...Imp-HTML Table Sorting   Hi, I am working on a project and as per requirement from client i have to sort a table based on the ID Column. I want
How to insert multiple drop down list data in single column in sql database using servlet
How to insert multiple drop down list data in single column in sql database using servlet  i want to insert date of birth of user by using separate drop down list box for year,month and day into dateofbirth column in sql server
Export Data into CSV file uing JDBC in JSP
Export Data into CSV file uing JDBC in JSP       CSV file : A CSV file is commonly known...;) to export data into  CSV file "myjdbcfile.csv".  ADS
SQL Add Column Int
SQL Add Column Int       SQL Add Column Int is used to add new column, whose field data type... The Tutorial illustrate a SQL Add Column Int example .In this Tutorial we create a table
Retrieve Data from CSV file in JSP
Retrieve Data from CSV file in JSP       CSV file : A CSV file is commonly known as a Comma... folder Create a Page ("ReadCsvFile.jsp") to retrieve the data from CSV
Sorting in java - Java Beginners
Sorting in java  Hello.. I want you to help me with this question.. 1. A statistics company wants to keep information of families. The information... member. The families are sorted alphabetically by family name. a. What
SQL Alter Column Size
information upon on table attribute like column name, data type, null... SQL Alter Column Size       Alter Column Size modify the Column Size. The SQL Alter Column Size
displaying data for a single column from Mysql database in the list box in php form
displaying data for a single column from Mysql database in the list box in php form  I have a form in php.want to display data from a single column in an listbox in php.thanks..   <?php $data = @mysql_query("select
Sorting and Searching
Sorting and Searching  Hi i would really be thankful if someone could... programming language using a number in the range 0 - 10. The data input is ended... average - no data"); catch(IOException
Swings JTable numberic sorting - Swing AWT
and jdk1.6 is providing by default sorting of text column in JTable or suggestion for sorting of numberic column in JTable of Swings...Swings JTable numberic sorting
Array sorting - Java Beginners
Array sorting   Hello All. I need to sort one array based... need to sort the "name" array alphabetically. I can do that easily using... will be lost. I need to re-order the "name" array alphabetically so that my "type
JSF column Tag
is used for creating columns of a table. This tag creates a data column inside a data table. By this table you can specify number of column... for specific column by using data array. JSF data table creates multiple
Jdbc Get Column Names
Jdbc Get Column Names       The JDBC Get Column Names return you the property of the retrieved Column like its field name and data type using meta Data. Understand
SQL Alter Column type
SQL Alter Column type       Alter Column type in SQL is used to change or recreate the data type of existing column. Understand with ExampleADS_TO_REPLACE_1 The Tutorial
Csv Problem
more CSV having list of all the employees haing the complete data (Name, Id...) then sum the salary for both departments and put it into csv haing following data...Csv Problem  write a program assuming u have 1. Employee class having

Ads