in reply to Replacing Lines in 100 Gig file
Ah! A use for perl's flip-flip operator:
#!/usr/bin/perl -w while (<DATA>) { next if m|</root>|..m|<root>|; print; } print "</root>\n"; __DATA__ <?xml version="1.0" encoding="UTF-8"?> <root> <some_xml></some_xml> </root> <?xml version="1.0" encoding="UTF-8"?> <root> <some_xml></some_xml> </root> <?xml version="1.0" encoding="UTF-8"?> <root> <some_xml></some_xml> </root>
-b
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replacing Lines in 100 Gig file
by amw1 (Friar) on Dec 17, 2004 at 18:06 UTC | |
by bgreenlee (Friar) on Dec 17, 2004 at 18:31 UTC |