- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: insert lines feeds in XML document
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-28-2004 09:41 PM
тАО11-28-2004 09:41 PM
insert lines feeds in XML document
I have an XML document with multiple tags but when I open it with notepad or vi there are only 2 lines. How could I (using sed or perl) add lines feeds / carriage returs in this files ? I tried:
sed "s/\/>/\n/g"
sed "s/\/>/^M/g"
but is doesn't work.
Best regards,
Ulrich Delvaux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2004 12:02 AM
тАО11-29-2004 12:02 AM
Re: insert lines feeds in XML document
while (
@madman=split(/^M/);
if ($#madman > 0) {
for ( $i=0; $i <=$#madman; $i++ ) {
$tmpline=$madman[$i];
chomp($tmpline);
printf("%s\n",$tmpline);
}
} else {
$tmpline=$_;
chomp($tmpline);
printf("%s\n",$tmpline);
}
}
live free or die
harry d brown jr
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2004 12:30 AM
тАО11-29-2004 12:30 AM
Re: insert lines feeds in XML document
I don't understand your code. I tried it out but it just repeats what I type. In general what I need to do is:
file in:
this is a test xxx on xxx how to xxx split
file out:
this is a test
on
how to
split
I don't see what the madman parameter means in the perl.
Can you help please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2004 12:43 AM
тАО11-29-2004 12:43 AM
Re: insert lines feeds in XML document
cat oldfile | ./zapper > newfile
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2004 12:58 AM
тАО11-29-2004 12:58 AM
Re: insert lines feeds in XML document
I placed the code in toto.pl and executed:
cat test | ./toto.pl > testout
testout contains the same as test whatever I put in test. I still don't see what the madman thing does?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2004 01:12 AM
тАО11-29-2004 01:12 AM
Re: insert lines feeds in XML document
go to this line: @madman=split(/^M/);
replace the ^M (it probably put two characters in your toto.pl instead of a ctrl-m) with \r to give:
@madman=split(/\r/);
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2004 01:26 AM
тАО11-29-2004 01:26 AM
Re: insert lines feeds in XML document
Now it works, thanks a lot. I also got following working:
perl -p -e 's/\/>/\r\n/g' ulli.XML > test
Ulrich