root/trunk/midgard/tools/yamp/remove_persons.pl
| Revision 6973, 385 bytes (checked in by classic, 6 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | # remove _all_ persons from xml file |
| 4 | # remember to reset all person references to the SG0 Admin before. |
| 5 | |
| 6 | |
| 7 | local $/; |
| 8 | |
| 9 | open FILE, "< $ARGV[0]"; |
| 10 | $xml = <FILE>; |
| 11 | close FILE; |
| 12 | |
| 13 | # remove all "grp" elements (scary) |
| 14 | $xml =~ s#<person.*?>.*?</person>##sg; |
| 15 | |
| 16 | open FILE2, "> /tmp/$1.$$"; |
| 17 | print FILE2 $xml; |
| 18 | close FILE2; |
| 19 | |
| 20 | system("mv", "/tmp/$1.$$", $ARGV[0]); |
| 21 | unlink("/tmp/$1.$$"); |
Note: See TracBrowser for help on using the browser.
