Sponsored Content
Top Forums Shell Programming and Scripting Converting Text File into XML using Unix Shell Scripts Post 62478 by photon on Wednesday 16th of February 2005 11:48:32 AM
Old 02-16-2005
Quote:
Originally posted by Laud12345
The file has fields with each field having a certain number of bytes
That is dependent on number of characters in field, ASCII
is an encoding where each character is represented as
exactly one byte.

It is clear from the sample data you have given there is a
set pattern from alpha characters to digits.

C has isalpha() and isdigit() and most other languages have
something similar to this.

If you use regular expressions [A-Z] or [a-z] and [0-9] will work.

Not given enough information on your sample data, you may
try splitting on whitespace or from alpha char to digit.

Last edited by photon; 02-16-2005 at 01:36 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Plz Help To convert xml file to text file using bourn shell scripts

If someone out there could help me out with this problem. I would really appreciate it. I am trying to convert xml into text file(fixed length) using Unix Borne shell scripts. My xml file: <root> <header_rec recordtype="00"> <record_id>00</record_id> <country_code>AK></country_code>... (0 Replies)
Discussion started by: ram2s2001
0 Replies

2. Windows & DOS: Issues & Discussions

Converting UNIX scripts to DOS

Is there a tool available to convert UNIX (BASH Shell) scripts to DOS scripts? I understand that DOS scripting is far inferior to unix scripting, and therfore this conversion may not be possible. Alternativley, perhaps I could convert my Unix scripts to C... then compile it for a windows... (2 Replies)
Discussion started by: Crozz
2 Replies

3. Shell Programming and Scripting

Shell program to check if the same text appears twice in an XML file

Hi All, I am very new to this forum and beginner to shell scripting. I need a shell script to: Search for a text in XML file à if the same text appears twice in an XML file à output file name Script should loop thru every xml file of a given folder. Please help me writing this script. ... (1 Reply)
Discussion started by: amardeep001
1 Replies

4. UNIX for Dummies Questions & Answers

converting scripts from dos 2 unix format

Hi, I am new to shell scripting and exploring it , I have developed few sample shell script but I have developed them on windows xp notepad and then saving them on folder and then testing them on cywgin and running perfectly...but these scripts are in dos format and I want to convert them in unix... (1 Reply)
Discussion started by: rahul125
1 Replies

5. Shell Programming and Scripting

XML to Text file Parsing Using shell scripting

Hi folks, Need some help with XML to text file parsing , the following is the content of the XML File. <xn:SubNetwork id="SNJNPRZDCR0R03"> <xn:MeContext id="PRSJU0005"> <xn:VsDataContainer id="PRSJU0005"> <xn:attributes> ... (6 Replies)
Discussion started by: tech_frk
6 Replies

6. Shell Programming and Scripting

Help with converting XML to Flat file

Hi Friends, I want to convert a XML file to flat file. Sample I/p: <?xml version='1.0' encoding='UTF-8' ?> <DataFile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' contactCount='4999' date='2012-04-14' time='22:00:14' xsi:noNamespaceSchemaLocation='gen .xsd'> <Contact... (3 Replies)
Discussion started by: karumudi7
3 Replies

7. Solaris

XML to Text file Parsing Using shell scripting

Hi, I want to parse an XML File using Shell Script preferably by using awk command, I/P file is : <gn:ExternalGsmCell id="016P3A"> <gn:attributes> <gn:mnc>410</gn:mnc> <gn:mcc>310</gn:mcc> <gn:lac>8016</gn:lac> ... (2 Replies)
Discussion started by: tech_frk
2 Replies

8. UNIX for Dummies Questions & Answers

Reading XML file and print the values in the text file using Linux shell script

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies

9. Programming

How to write in other language in text/xml file by reading english text/xml file using C++?

Hello Team, I have 2 files.one contains english text and another contains Japanese. so i have to read english text and replace the text with Japanesh text in third file. Basically, I need a help to write japanese language in text/xml file.I heard wstring does this.Not sure how do i write... (2 Replies)
Discussion started by: SA_Palani
2 Replies
ctype(3)						     Library Functions Manual							  ctype(3)

NAME
isalnum, isalpha, isascii, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit - Classify characters LIBRARY
Standard C Library (libc) SYNOPSIS
#include <ctype.h> int isalnum( int c); int isalpha( int c); int isascii( int c); int iscntrl( int c); int isdigit( int c); int isgraph( int c); int islower( int c); int isprint( int c); int ispunct( int c); int isspace( int c); int isupper( int c); int isxdigit( int c); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: isalnum(), isalpha(), isascii(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the character to be tested. In all cases, this parameter is an int data type, whose value must be representable as an unsigned char or must equal the value of the macro EOF (defined in the stdio.h include file). When this parameter has a value that cannot be repre- sented as an unsigned char or EOF, the result is undefined. DESCRIPTION
The ctype functions test for membership in a character class in the current locale. Each function tests to see if a character is part of a different character class. If the character is part of the character class, the function returns a nonzero value for true; otherwise, the function returns a value of 0 (zero) for false. Each function is named by adding the prefix is to the name of the character class for which the function tests. For example, the isalpha() function tests whether the character specified by the c parameter belongs to the alpha class. The following lists the function names and describes the conditions under which the functions return a true value. When c is a character of class alpha or class digit in the program's current locale. When c is a character of class alpha in the program's current locale. Char- acters in classes lower and upper automatically belong to class alpha. When c is a 7-bit US-ASCII character whose value is in the range 0 to 0177 (0 to 0x7F), inclusive. When c is a character of class cntrl in the program's current locale. When c is a character of class digit in the program's current locale. The following characters are included in this class: 0 1 2 3 4 5 6 7 8 9 When c is a character of class graph in the program's current locale. Characters in classes alpha, digit, and punct are automatically in class graph. Unlike isprint(), isgraph() returns FALSE for the space character. When c is a character of class lower in the program's current locale. At a minimum, the 26 lowercase US-ASCII characters are included in this class. These are: a b c d e f g h i j k l m n o p q r s t u v w x y z When c is a character of class print in the program's current locale. All char- acters in the class graph and the space character are automatically included in the class print. When c is a character of class punct in the program's current locale. When c is a character of class space in the program's current locale. At a minimum, the space, form-feed, newline, carriage-return, tab, and vertical-tab characters are included in this class. When c is a character of class upper in the program's current locale. At a minimum, the 26 uppercase US-ASCII characters are included in this class. These are: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z When c is a character of class xdigit in the program's current locale. The fol- lowing characters are included in this class: 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f NOTES
The LC_CTYPE category of the current locale affects all conversions. In the C locale, or in a locale where character-type information is not defined, characters are classified according to the rules of the ASCII character set. For any character value greater than octal 177 (0177 in C-language context) the value 0 (zero) is returned. [Tru64 UNIX] The isdigit(), isxdigit(), and isalnum() functions do not recognize Thai digits. Many applications make assumptions about how a digit character can be converted to its numeric equivalent. Changing the functions to recognize Thai digits would break these applica- tions. Refer to TACTIS(5) for more information about Thai digits. RETURN VALUES
Upon successful completion of any function, a nonzero (TRUE) value is returned. Otherwise, the value 0 (FALSE) is returned. RELATED INFORMATION
Files: locale(4) Functions: ctype(3), setlocale(3), wctype(3) Standards: i18n_intro(5), standards(5) delim off ctype(3)
All times are GMT -4. The time now is 02:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy