I need to output my hadoop result in .csv format. how will i do this? My code :https://github.com/studhadoop/xml/blob/master/XmlParser11.java
should i simply include csvoutputFormat in my code. I am using mapreduce API
myjob.sh
bin/hadoop jar /var/root/ALA/ala_jar/clsperformance.jar ala.clsperf.ClsPerf /user/root/ala_xmlrpt/Amrita\ Vidyalayam\,\ Karwar_Class\ 1\ B_ENG.xml /user/root/ala_xmlrpt-outputshell4
bin/hadoop fs -get /user/root/ala_xmlrpt-outputshell4/part-r-00000 /Users/jobsubmit
cat /Users/jobsubmit/part-r-00000 /Users/jobsubmit/output.csv
SOLUTION
ys i was missing > in cat
cat /Users/jobsubmit/part-r-00000> /Users/jobsubmit/output.csv
You can use TextOutputFormat. The default key/ value separator is a tab character. You can change the separator by setting the property "mapred.textoutputformat.separatorText" in your driver.
conf.set("mapred.textoutputformat.separatorText", ",");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With