Sponsored Content
Full Discussion: Convert xml to csv
Top Forums Shell Programming and Scripting Convert xml to csv Post 302591236 by dineshydv on Thursday 19th of January 2012 12:02:16 AM
Old 01-19-2012
Convert xml to csv

I need to convert below xml code to csv. I searched other posts as well but this post (_https://www.unix.com/shell-programming-scripting/174417-extract-parse-xml-data-statistic-value-csv.html) gives "sed command garbled" error. As of now I have written a long script to do it, but can it be done with single sed command.??
XML :
Code:
<ticketing>     
    <ticketingProduct name="Prod 4">       
        <ticketingEvent>Prod 4 - Event 1</ticketingEvent>     
        <ticketingEvent>Prod 4 - Event 2</ticketingEvent>     
        <ticketingEvent>Prod 4 - Event 3</ticketingEvent>     
    </ticketingProduct> 
    <ticketingProduct name="Prod 3">      
        <ticketingEvent>Prod 3 - Event 1</ticketingEvent>    
        <ticketingEvent>Prod 3 - Event 2</ticketingEvent>    
    </ticketingProduct>
    <ticketingProduct name="Prod 2">      
        <ticketingEvent>Prod 2 - Event 1</ticketingEvent>    
    </ticketingProduct> 
    <ticketingProduct name="Prod 1">      
        <ticketingEvent>Prod 1 - Event 1</ticketingEvent>    
        <ticketingEvent>Prod 1 - Event 2</ticketingEvent>    
    </ticketingProduct>  
</ticketing>

and what i need is
Code:
Prod 4,Prod 4 - Event 1
Prod 4,Prod 4 - Event 2
Prod 4,Prod 4 - Event 3
Prod 3,Prod 3 - Event 1
Prod 3,Prod 3 - Event 2
Prod 2,Prod 2 - Event 1
Prod 1,Prod 1 - Event 1
Prod 1,Prod 1 - Event 2

basically its in format ticketingProduc, ticketingEvent
any suggestion is appreciated..

Moderator's Comments:
Mod Comment How to use code tags

Last edited by Franklin52; 01-19-2012 at 03:51 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sample Unix script file to convert .xml to .csv

Dear all, Can you send me a script file the changes .xml to .csv file. Thanks, Srinivasa (4 Replies)
Discussion started by: srinivasaphani
4 Replies

2. Shell Programming and Scripting

Help to convert XML to CSV

Apologies if this has already been covered in this site somewhere, I did try looking but without any success. I am new to the whole XML thing, very late starter, and have a requirement to convert an XML fiule to a CSV fomat. I am crrently working on a Solaris OS. Does anyone have any suggestions,... (2 Replies)
Discussion started by: rossingi_33
2 Replies

3. Shell Programming and Scripting

Convert XML to CSV format

Can any one give the idea on this, please. I have the following XML file and wants to convert into CSV(comma separated value) format. <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE Waveset PUBLIC 'waveset.dtd' 'waveset.dtd'> <Waveset> <Object name='ra8736'> <Attribute name='ADDRESS'... (2 Replies)
Discussion started by: kumar04
2 Replies

4. UNIX for Dummies Questions & Answers

urgent help to convert xml to xsl or csv

Urgent help to transfer data from .xml to xl sheet where each attribute and value goes into seperate column.Please help me with the command.Please help Thanks Uma (9 Replies)
Discussion started by: umapearl
9 Replies

5. Shell Programming and Scripting

awk convert xml to csv

Hi, I have an xml file and I want to convert it with awk in to a csv file Test.xml <Worksheet ss:Name="Map1"> <Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="2" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="60"> <Row> <Cell><Data... (6 Replies)
Discussion started by: research3
6 Replies

6. Shell Programming and Scripting

convert huge .xml file in .csv with specific column.

I have huge xml file in server and i want to convert it to .csv with specific column ... i have search in blog but i didn't get any usefully command. Thanks in advance (1 Reply)
Discussion started by: pareshkp
1 Replies

7. Shell Programming and Scripting

Convert XML file to CSV file

Hi Guys, I am new to Shell scripting and need to convert an XML files to a CSV file. My actual problem is that XML file loading is taking hours and I have decided to convert the XML structure to row based data in a CSV file. My XML file: Message846 can repeat within main loop and... (1 Reply)
Discussion started by: qamar.shahbaz
1 Replies

8. Shell Programming and Scripting

How to convert xml to csv ?

I am in need of converting billions of XML into csv file to load data to DB, i have found the below code in perl but not sure why it's not working properly. CODE: #!/usr/bin/perl # Script to illustrate how to parse a simple XML file # and pick out all the values for a specific element, in... (1 Reply)
Discussion started by: rspwilliam
1 Replies

9. Shell Programming and Scripting

Convert XML to CSV using awk or shell script

Hello, I am working on a part of code where I need a awk or shell script to convert the given XML file to CSV or TXT file. There are multiple xml files and of different structure, so a single script is required for converting data. I did find a lot of solutions in the forum but... (16 Replies)
Discussion started by: Rashmitha
16 Replies

10. UNIX for Advanced & Expert Users

Convert CSV file to nested XML file using UNIX/PERL?

we have a CSV which i need to convert to XML using Perl or Unix shell scripting. I was able to build this XML in oracle database. However, SQL/XML query is running for long time. Hence, I'm considering to write a Perl or shell script to generate this XML file. Basically need to build this XML... (3 Replies)
Discussion started by: laknar
3 Replies
sane-plustek(5) 					   SANE Scanner Access Now Easy 					   sane-plustek(5)

NAME
sane-plustek - SANE backend for LM983[1/2/3] based USB flatbed scanners DESCRIPTION
The sane-plustek library implements a SANE (Scanner Access Now Easy) backend that provides access to USB flatbed scanners based on National Semiconductor Merlin chipsets (LM9831, 9832 and 9833). If you're looking for parallel-port support for Plustek scanner please refer to the sane-plustek_pp backend. SUPPORTED DEVICES
The Backend is able to support USB scanner based on the National Semiconductor chipsets LM9831, LM9832 and LM9833. The following tables show various devices which are currently reported to work. If your Plustek scanner has another Product ID, then the device is NOT supported by this backend. Vendor Plustek - ID: 0x07B3 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- OpticPro U12 LM9831 600x1200dpi 42bit 512Kb 0x0010 OpticPro UT12 LM9831 600x1200dpi 42bit 512Kb 0x0013 OpticPro UT12 LM9832 600x1200dpi 42bit 512Kb 0x0017 OpticPro UT16 LM9832 600x1200dpi 42bit 512Kb 0x0017 OpticPro U24 LM9831 1200x2400dpi 42bit 2Mb 0x0011 OpticPro U24 LM9832 1200x2400dpi 42bit 2Mb 0x0015 OpticPro UT24 LM9832 1200x2400dpi 42bit 2Mb 0x0017 Vendor KYE/Genius - ID: 0x0458 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- Colorpage HR6 V2 LM9832 600x1200dpi 42bit 512Kb 0x2007 Colorpage HR6 V2 LM9832 600x1200dpi 42bit 512Kb 0x2008 Colorpage HR6A LM9832 600x1200dpi 42bit 512Kb 0x2009 Colorpage HR7 LM9832 600x1200dpi 42bit 512Kb 0x2013 Colorpage HR7LE LM9832 600x1200dpi 42bit 512Kb 0x2015 Colorpage HR6X LM9832 600x1200dpi 42bit 512Kb 0x2016 Vendor Hewlett-Packard - ID: 0x03F0 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- ScanJet 2100C LM9831 600x1200dpi 42bit 512Kb 0x0505 ScanJet 2200C LM9832 600x1200dpi 42bit 512Kb 0x0605 Vendor Mustek - ID: 0x0400 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- BearPaw 1200 LM9831 600x1200dpi 42bit 512Kb 0x1000 BearPaw 1200 LM9832 600x1200dpi 42bit 512Kb 0x1001* BearPaw 2400 LM9832 1200x2400dpi 42bit 2Mb 0x1001 * see also description for model override switch below! Vendor UMAX - ID: 0x1606 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- UMAX 3400 LM9832 600x1200dpi 42bit 512Kb 0x0050 UMAX 3400/3450 LM9832 600x1200dpi 42bit 512Kb 0x0060 UMAX 5400 LM9832 1200x2400dpi 42bit 512Kb 0x0160 Vendor COMPAQ - ID: 0x049F ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- S4-100 LM9832 600x1200dpi 42bit 512Kb 0x001A Vendor Epson - ID: 0x04B8 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- Perfection 1250 LM9832 1200x2400dpi 42bit 512Kb 0x010F Perfection 1260 LM9832 1200x2400dpi 42bit 512Kb 0x011D Vendor CANON - ID: 0x04A9 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- CanoScan N650/656U LM9832 600x1200dpi 42bit 512Kb 0x2206 CanoScan N1220U LM9832 1200x2400dpi 42bit 512Kb 0x2207 CanoScan D660U LM9832 600x1200dpi 42bit 512Kb 0x2208 CanoScan N670/676U LM9833 600x1200dpi 48bit 512Kb 0x220D CanoScan N1240U LM9833 1200x2400dpi 48bit 512Kb 0x220E CanoScan LIDE20 LM9833 600x1200dpi 48bit 512Kb 0x220D CanoScan LIDE25 LM9833 1200x2400dpi 48bit 512Kb 0x2220 CanoScan LIDE30 LM9833 1200x2400dpi 48bit 512Kb 0x220E Vendor Syscan - ID: 0x0A82 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- Travelscan 662 LM9833 600x1200dpi 48bit 512Kb 0x6620 Travelscan 464 LM9833 600x1200dpi 48bit 512Kb 0x4600 Vendor Portable Peripheral Co., Ltd. - ID: 0x0A53 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- Q-Scan USB001 LM9832 300x600dpi 42bit 512Kb 0x1000 Vendor Visioneer - ID: 0x04A7 ---------------------------------------------------------- USB Model: ASIC: Properties: Prod-ID ---------------------------------------------------------- Strobe XP100 LM9833 600x1200dpi 48bit 512Kb 0x0427 OTHER PLUSTEK SCANNERS
For parallelport device support see the plustek_pp backend. The SCSI scanner OpticPro 19200S is a rebadged Artec AM12S scanner and is supported by the Artec backend. Only the National Semiconductor LM983[1/2/] based devices of Plustek are supported by this backend. Older versions of the U12, the UT12, the U1212 and U1248 (GrandTech chipset) are not supported. Model Chipset backend ------------------------------------ U1248 GrandTech gt68xx UT16B GrandTech gt68xx OpticSlim 1200 GrandTech gt68xx OpticSlim 2400 GrandTech gt68xx U12 P98003 u12 UT12 P98003 u12 1212U P98003 u12 For a more complete and up to date list see: http://www.sane-project.org/sane-supported-devices.html CONFIGURATION
To use your scanner with this backend, you need at least two entries in the configuration file /etc/sane.d/plustek.conf [usb] vendor-id product-id device /dev/usbscanner [usb] tells the backend, that the following devicename (here /dev/usbscanner) has to be interpreted as USB scanner device. If vendor- and product-id has not been specified, the backend tries to detect this by its own. If device is set to auto then the next matching device is used. The following options can be used for a default setup of your device. Most of them are also available through the frontend. The Options: option warmup t t specifies the warmup period in seconds, if set to -1, the automatic warmup function will be used option lampOff t t is the time in seconds for switching off the lamps in standby mode option lOffonEnd b b specifies the behaviour when closing the backend, 1 --> switch lamps off, 0 --> do not change lamp status option mov m m is the model override switch. It works only with Mustek BearPaw devices. m/PID | 0x1000 | 0x1001 ------+--------------+-------------- 0 | BearPaw 1200 | BearPaw 2400 1 | no function | BearPaw 1200 option invertNegatives b b 0 --> do not invert the picture during negativ scans, 1 --> invert picture option cacheCalData b b 0 --> do not save calibration results, 1 --> save results of calibration in ~/.sane/ directory option altCalibration b b 0 --> use standard calibration routines, 1 --> use alternate calibration (only non Plustek devices, standard for CIS devices) option skipFine b b 0 --> perform fine calibration, 1 --> skip fine calibration (only non Plustek devices) option skipFineWhite b b 0 --> perform white fine calibration, 1 --> skip white fine calibration (only non Plustek devices) option skipDarkStrip b b 0 --> perform dark calibration, with enabled lamp using the dark calibration strip of the scanner. If the scanner does not have such a strip, the alternative way is to switch off the lamp during this step. 1 --> always switch off the lamp for dark calibration, even a black strip is available option skipCalibration b b 0 --> perform calibration, 1 --> skip calibration (only non Plustek devices) option enableTPA b b 0 --> default behaviour, specified by the internal tables, 1 --> override internal tables and allow TPA mode (EPSON/UMAX only) option posOffX x option posOffY y option tpaOffX x option tpaOffY y option negOffX x option negOffY y x y By using this settings, the user can adjust the given image positions. Please note, that there's no internal range checking for this feature. option posShadingY p option tpaShadingY p option negShadingY p p overrides the internal shading position. The values are in steps. Please note, that there's no internal range checking for this feature. option redGamma r option greenGamma g option blueGamma b option grayGamma gr r g b gr By using these values, the internal linear gamma table (r,g,b,gr = 1.0) can be adjusted. option red_gain r option red_offset ro option green_gain g option green_offset go option blue_gain b option blue_offset bo r g b ro go bo These values can be used to set the gain and offset values of the AFE for each channel. The range is between 0 and 63. -1 means autocalibration. See the plustek.conf file for examples. Note: You have to make sure, that the USB subsystem is loaded correctly and you have access to the device-node. For more details see sane-usb (5) manpage. You might use sane-find-scanner to check that you have access to your device. Note: If there's no configuration file, the backend defaults to device auto FILES
/etc/sane.d/plustek.conf The backend configuration file /usr/lib64/sane/libsane-plustek.a The static library implementing this backend. /usr/lib64/sane/libsane-plustek.so The shared library implementing this backend (present on systems that support dynamic loading). ENVIRONMENT
SANE_CONFIG_DIR This environment variable specifies the list of directories that may contain the configuration file. Under UNIX, the directories are separated by a colon (`:'), under OS/2, they are separated by a semi-colon (`;'). If this variable is not set, the configura- tion file is searched in two default directories: first, the current working directory (".") and then in /etc/sane.d. If the value of the environment variable ends with the directory separator character, then the default directories are searched after the explic- itly specified directories. For example, setting SANE_CONFIG_DIR to "/tmp/config:" would result in directories "tmp/config", ".", and "/etc/sane.d" being searched (in this order). SANE_DEBUG_PLUSTEK If the library was compiled with debug support enabled, this environment variable controls the debug level for this backend. Higher debug levels increase the verbosity of the output. Example: export SANE_DEBUG_PLUSTEK=10 SEE ALSO
sane(7), sane-usb(5), sane-u12(5), sane-gt68xx(5), /usr/share/doc/packages/sane-backends/plustek/Plustek-USB.changes http://www.gjaeger.de/scanner/plustek/ CONTACT AND BUG-REPORTS Please send any information and bug-reports to: SANE Mailing List Additional info and hints can be obtained from our Mailing-List archive at: http://www.sane-project.org/mailing-lists.html or directly from the projects' homepage at: http://www.gjaeger.de/scanner/plustek/ To obtain debug messages from the backend, please set the environment-variable SANE_DEBUG_PLUSTEK before calling your favorite scan-fron- tend (i.e. xscanimage). i.e.: export SANE_DEBUG_PLUSTEK=20 ; xscanimage The value controls the verbosity of the backend. Please note, that values greater than 24 force the backend to output raw data files, which could be rather large. The ending of these files is ".raw". For problem reports it should be enough the set the verbosity to 13. KNOWN BUGS &; RESTRICTIONS * The driver does not support these manic scalings up to 16 times the physical resolution. The only scaling is done on resolutions between the physical resolution of the CCD-/CIS-sensor and the stepper motor i.e. you have a 600x1200 dpi scanner and you are scanning using 800dpi, so scaling is necessary, because the sensor only delivers 600dpi but the motor is capable to perform 1200dpi steps. * Plusteks' model policy is somewhat inconsistent. They sell technically different devices under the same product name. Therefore it is possible that some devices like the UT12 or U12 won't work - please check the model list above and compare the product-id to the one your device has. * Negative/Slide scanning quality is poor. 25 Aug 2008 sane-plustek(5)
All times are GMT -4. The time now is 11:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy