Padding Carriage return to the end of XML file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Padding Carriage return to the end of XML file
# 1  
Old 05-23-2008
Lightbulb Padding Carriage return to the end of XML file

Hi All,
I am getting a xml file where the first field contains a carriage return and the all other fields doesnot contains any carriage return. So all the other records comes in the second line.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:iSeriesCspIntegration xmlns:ns0="http://www.ABC.com/xmlschema/cspintegration/"><header><flow>ACTRSP</flow><sender name="PQR"></sender><receiver name="CspHost"></receiver><generationDate>20080522-133152</generationDate>


So, basically i want to put a carriage return at the end of each closeing tag.
like this:

<?xml version="1.0" encoding="UTF-8"?> ["carriage return" ]
<ns0:iSeriesCspIntegration xmlns:ns0="http://www.ABC.com/xmlschema/cspintegration/"> ["carriage return" ]
<header> ["carriage return" ]
<flow>ACTRSP</flow> ["carriage return" ]
<sender name="PQR"></sender> ["carriage return" ]

can this be done in unix script.
please let me know the code that need to written for this.
# 2  
Old 05-23-2008
Do you mean "line-feed"or "carriage-return"?

this will append a newline...

Code:
echo >>file

Does this solve the problem..?
# 3  
Old 05-23-2008
reply

NO it does not solve my problem..
I have already tried with this..
# 4  
Old 05-23-2008
dasj22

I want a carriage return,,
not a line feed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Enter carriage return in xml file after each tag (> sign)

I have an xml file which is generated in a single line an looks like this <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?><Batch_Id="1999996" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><some data....><some data....>closing lines...... I need to have a separate line... (3 Replies)
Discussion started by: vx04
3 Replies

2. Shell Programming and Scripting

Need Help to delete carriage return and new line in csv file

Hi All, I have a problem loading the data from a csv file As you see below in the Input ,For the Data starting with " there are 2 lines, which i want to make them into single without changing the format of that data. You can see the desired output below: While i try to open the csv file and... (4 Replies)
Discussion started by: mlavanya
4 Replies

3. Shell Programming and Scripting

Removing Carriage return in a file after particular string

Hi All, I want to remove carriage return in a file using some unix command without writing a script my file is as follows abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 I want the output as follows: abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 , Please... (7 Replies)
Discussion started by: manish8484
7 Replies

4. Shell Programming and Scripting

Need a carriage return at end of each line

Hi All, I am reading two files and writing out the file name and count of lines in each file to an output file. My script looks like this: echo "input_file1.out;`wc -l < input_file1.out | sed 's/^]*\(.*\)]*$/\1/'` " > comp_file1.out echo "input_file2.out;`wc -l < input_file2.out | sed... (2 Replies)
Discussion started by: Hangman2
2 Replies

5. Shell Programming and Scripting

add carriage return at end of file

Hi I would like to add carriage return at end of file, because we need to mask the customer names for detailed records. Some what the file doesnot have carriage at end of line of last record.So that i 'll get 2 records when use ---aa.txt----- 1|aaa|bbb|ccc 2|bbbb|hghgh|ggg 000002 tail... (2 Replies)
Discussion started by: HAA
2 Replies

6. Shell Programming and Scripting

Carriage Return at end of file

Hi, I have a script that outputs a file that contains the dates from the previous month, which is then used by our application to run processes on each date contained in the file. My problem is is that my script created a blank line at the bottom of the file which causes issues for our... (14 Replies)
Discussion started by: bd_joy
14 Replies

7. Shell Programming and Scripting

Removing Carriage Return and or line feed from a file

Hello I'm trying to write a shell script which can remove a carriage return and/or line feed from a file, so the resulting file all ends up on one line. So, I begin with a file like this text in file!<CR> line two!<CR> line three!<CR> END!<CR> And I want to end up with a file... (1 Reply)
Discussion started by: tbone231
1 Replies

8. UNIX for Dummies Questions & Answers

Remove a carriage return at end of variable

Is there a command in unix to remove a carriage return character(^M) at the end of a variable value? (5 Replies)
Discussion started by: flagship99
5 Replies

9. UNIX for Dummies Questions & Answers

Removing carriage return characters from file

Hello there, I need to remove carriage return characters (\n and \r) from any input file specified. This is what I am doing right now: - dumping the file to octal format using the command 'od -c file_name - removing and \s and \n characters using sed commands What I need to do now is... (3 Replies)
Discussion started by: b1saini
3 Replies

10. Shell Programming and Scripting

Regex to pick up name from the following including carriage return at end of the line

has anyone got any suggestions how i would pick up the string as part of a substitution inclusive of the carriage return. ie i want to pick up <<NAME>> from the PS output but the <<; seems to be on the line before the NAME. Any ideas are appreciated! ... (3 Replies)
Discussion started by: Shakey21
3 Replies
Login or Register to Ask a Question