Created
May 3, 2011 17:55
-
-
Save I82Much/953837 to your computer and use it in GitHub Desktop.
Find missing tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def main(): | |
last_line = "" | |
for line in sys.stdin: | |
if "<user>" in last_line and "<user>" in line: | |
print "Here's the error, there is missing a close user tag before this point:" | |
print line | |
return | |
last_line = line | |
if __name__ == '__main__': | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep -Hin "</\?user>" Test.txt | python find_missing_tag.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<users> | |
<user> | |
</user> | |
<user> | |
<user> | |
</users> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment