Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need help converting txt to XML Post 302653675 by A-V on Saturday 9th of June 2012 06:40:27 PM
Old 06-09-2012
Need help converting txt to XML

I have a table as following

Archive idLineAuthorTime Text
1fjj34 375jk5l 03:20 this is an evidence regarding ...
1fjj34 4gjhhtrd03:21 we have seen those documents before
1fjj34 10645jmdvvb04:00 Will you consider such an offer?
3a530367rdnsa01:17 Will you consider such an offer?

but my separators are "|" so my plain text files looks like

Quote:
Archive id|Lie|Author|Time|Text
1fjj34|3|75jk5l|03:20|this is an evidence regarding xxx
1fjj34|4|gjhhtrd|03:21|we have seen those documents before
1fjj34|10|645jmdvvb|04:00|Will you consider such an offer?
3a530|3|67rdnsa|01:17|Will you consider such an offer?
I have absolute no ideal when where to start in relation to convert it to XML and my data is nested so bit confused. I would be grateful if you can help me.Smilie

the output structure is
Code:
< archives>
	...
	< archive id="1fjj34">
		<file line="3">
			<author>75jk5l</author>
			<time>03:20</time>
			<text> this is an evidence regarding xxx </text>
		</file>
		<file line="4">
			<author>gjhhtrd</author>
			<time>03:21</time>
			<text> we have seen those documents before </text>
		</file>
		...
		<file line="10">
			<author>645jmdvvb</author>
			<time>04:00</time>
			<text> Will you consider such an offer? </text>
		</file>
	</archive>
	...
	< archive id="3a530">
		<file line="3">
			<author>67rdnsa</author>
			<time>01:17</time>
			<text> Will you consider such an offer? </text>
		</file>
	</ archive>
	...
< archives>

note: the data has originally been in XML, I have received the help from this forum to convert in to txt which you can see in here. I have done all the calculation and filtering I needed and wished to convert it back to XML

Thank you in advance for your help
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

converting .txt

Hello, I transferred some .txt files from windows to Unix. When i used the editor in Unix to open up the file, all the <cr> show up. How to I get rid of all of them? (4 Replies)
Discussion started by: laila63
4 Replies

2. UNIX for Dummies Questions & Answers

converting txt files in linux to windows

HI.. i have this problem..i want to copy a text file from linux and import it into an access file..but so many junk characters are coming in between..what i have to do.. plz help.. thanx in advance, (4 Replies)
Discussion started by: newbuddy
4 Replies

3. UNIX for Advanced & Expert Users

Cutting two colums and converting them to ascii (.txt) format

Hello Gurus, I have a file in which two columns contains binary data i want to cut those two binary columns convert them to ascii and process the file. i tried using cut command..i am able to cut but how can i convert them from binary to ascii and paste them in their original position. ... (1 Reply)
Discussion started by: mora
1 Replies

4. Shell Programming and Scripting

converting .txt to comma delimeted file

Dear all, I have a file with 5L records. one of the record in the file is as shown below. MARIA THOMAS BASIL 1000 FM 1111 MD GHANA YY 77354 4774 99999999 1234567 I need to convert this record in below format "","","","","MARIA","THOMAS","BASIL","","1000 FM 1111 MD","STE... (1 Reply)
Discussion started by: OSD
1 Replies

5. Shell Programming and Scripting

Converting txt file in csv

HI All, I have a text file memory.txt which has following values. Average: 822387 7346605 89.93 288845 4176593 2044589 51883 2.47 7600 i want to convert this file in csv format and i am using following command to do it. sed s/_/\./g <... (3 Replies)
Discussion started by: mkashif
3 Replies

6. Shell Programming and Scripting

Converting txt file into CSV using awk or sed

Hello folks I have a txt file of information about journal articles from different fields. I need to convert this information into a format that is easier for computers to manipulate for some research that I'm doing on how articles are cited. The file has some header information and then details... (8 Replies)
Discussion started by: ksk
8 Replies

7. Shell Programming and Scripting

Weird issue in converting XLSX to TXT

Hi Guys, I have used Perl scripting to convert XLSX file to TXT file using Perl module Spreadsheet::XLSX. I processed one XLSX file having one column and 65k rows of data . Strangely ,It is merging data for every 2047 row and I could see data in TXT file as Ex: Suppose in XLSX file ,if... (2 Replies)
Discussion started by: Rajk459
2 Replies

8. UNIX for Dummies Questions & Answers

Converting txt output to rows and columns and send report via mail.

Hi All, I would like to send below output in a tabular column ( xml or excel ) and send a mail. vinay unix anil sql vamsee java request to suggest a solution. (1 Reply)
Discussion started by: Girish19
1 Replies

9. Shell Programming and Scripting

Using awk for converting xml to txt

Hi, I have a xml script, I converted it to .txt with values comma seperated using awk function. But I want the output values should be inside double quotes My xml script (Workorders.xml) is shown like below: <?xml version="1.0" encoding="utf-8" ?> <scbm-extract version="3.3">... (8 Replies)
Discussion started by: Viswanatheee55
8 Replies

10. Shell Programming and Scripting

Converting XML to CSV

Hello, For i while i have been using XMLStarlet to convert several XML files to CSV files. So far this always went fine. Today however i got a new XML format however but i cannot find out how to get the data i need. Below is part of the code where it shows the different format. What... (10 Replies)
Discussion started by: SDohmen
10 Replies
XALAN(1)						      General Commands Manual							  XALAN(1)

NAME
xalan - Process XML documents with XSLT stylesheets SYNOPSIS
xalan [options] DESCRIPTION
Xalan-C++ (named after a rare musical instrument) implements the W3C Recommendation 16 November 1999 XSL Transformations (XSLT) Version 1.0 and the XML Path Language (XPath) Version 1.0. XSLT is the first part of the XSL stylesheet language for XML. It includes the XSL Transfor- mation vocabulary and XPath, a language for addressing parts of XML documents. For links to background materials, discussion groups, fre- quently asked questions, and tutorials on XSLT, see Getting up to speed with XSLT. You use the XSLT language to compose XSL stylesheets. An XSL stylesheet contains instructions for transforming XML documents from one docu- ment type to another document type (XML, HTML, or other). In structural terms, an XSL stylesheet specifies the transformation of one tree of nodes (the XML input) into another tree of nodes (the output or transformation result). OPTIONS
Options are case-sensitive. -in URL Sets the input URL. If nothing is set, stdin is used. -xsl URL Sets the XSLT sheet URL. -out file Sets the output filename. -v Show version information only. -qc Quiet pattern conflicts warnings. -q Use quiet mode. -indent n Controls how many spaces to indent. Default is 0. -validate Controls whether validation occurs. Validation is off by default. -tt Trace the templates as they are being called. -tg Trace each generation event. -ts Trace each selection event. -ttc Trace the template children as they are being processed. -xml Use XML formatter and add XML header. -text Use simple Text formatter. -html Use HTML formatter. -dom Use DOM formatter. Formats to DOM, then formats XML for output. -xst Use source tree formatter. Formats to Xalan source tree, then formats XML for output. -param name expression Sets a stylesheet parameter. -xd Use Xerces DOM instead of Xalan source tree. -de Disable built-in extension functions The following option is valid only with -HTML -noindent Turn off HTML indenting. The following option is valid only with -XML. -nh Don't write XML header. AUTHOR
The Apache Software Foundation. SEE ALSO
http://www.w3.org/TR/xslt XSL Transformations Version 1.0 (XSLT) http://www.w3.org/TR/xpath XML Path Language Version 1.0 (XPATH) Debian GNU/Linux 2001 XALAN(1)
All times are GMT -4. The time now is 06:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy