Code snippet to cut XML files based on record length


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Code snippet to cut XML files based on record length
# 1  
Old 06-06-2016
Code snippet to cut XML files based on record length

I want to do FTP an Huge XML file to mainframe server using AIX server

Since my file size is huge, i want to split the XML file based on a delimiter , the record delimiter should be set after every 27000 bytes of data
and then do the ftp
This is done becos the data send to the mainframe must have records no longer than 27000 bytes; we CANNOT convert it on the mainframe

i need to read the XML file and i need to put the record delimiter after 27000 bytes and need to start a new record which has 27000 bytes

see below example

record 1:123....................27000|

record 2:123....................27000|

record 3 and so on

Please share the code snippet for the above example

Thanks!
# 2  
Old 06-06-2016
Please show an example of the input you have and the output you want. We'll need to know what your XML looks like and what this delimiter is.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Syntax error in code snippet

Hello, I am attaching a code snippet. Some of the variables are set in earlier code like count, arrays harr1, harr2, barr1 and barr2. The code below gives syntax errors. I am very new to Bash. for (( i=0; i<=$(( $count -1 )); i++ )) do #Now read the element at barr2 location i. Also find... (2 Replies)
Discussion started by: ngabrani
2 Replies

2. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies

3. Shell Programming and Scripting

Extract timestamp from first record in xml file and it checks if not it will replace first record

I have test.xml <emp><id>101</id><name>AAA</name><date>06/06/14 1811</date></emp> <Join><id>101</id><city>london</city><date>06/06/14 2011</date></join> <Join><id>101</id><city>new york</city><date>06/06/14 1811</date></join> <Join><id>101</id><city>sydney</city><date>06/06/14... (2 Replies)
Discussion started by: vsraju
2 Replies

4. UNIX for Dummies Questions & Answers

Code snippet for signals

Hi. This is code snipped I have. I am trying to play with signals... int main(int argc, char *argv) { int i; sigset_t s; //declare set of signals sigfillset(&s); //initializes the signal set to include all of the defined signals int j; for ( i = 0 ; i < 70 ; i++){ j... (6 Replies)
Discussion started by: joker40
6 Replies

5. Shell Programming and Scripting

Add character based on record length

All, I can't seem to find exactly what I'm looking for, and haven't had any luck patching things together. I need to look through a file, and if the record length is not 874, then add 'E' in position 778. Your help is greatly appreciated. (4 Replies)
Discussion started by: CutNPaste
4 Replies

6. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

7. Shell Programming and Scripting

Bash snippet to find files based on a text file?

Evening all. I'm having a terrible time with a script I've been working on for a few days now... Say I have a text file named top10song.tm2, with the following in it: kernkraft 400 Imagine i kissed a girl Thriller animals hallelujah paint it black psychosocial Oi to the world... (14 Replies)
Discussion started by: DJ Charlie
14 Replies

8. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

9. Shell Programming and Scripting

gui text box code snippet?

Hello, I have written some scripts that query the user and waits for keyboard input for an answer. I was wondering if there is any generic code snippets out there that would allow me to run this as a GUI. I am thinking of a simple dialogue box that would display the question and have a text... (1 Reply)
Discussion started by: Allasso
1 Replies
Login or Register to Ask a Question