Skip to content

Instantly share code, notes, and snippets.

@I82Much
Created May 3, 2011 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save I82Much/953837 to your computer and use it in GitHub Desktop.
Save I82Much/953837 to your computer and use it in GitHub Desktop.
Find missing tag
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()
grep -Hin "</\?user>" Test.txt | python find_missing_tag.py
<users>
<user>
</user>
<user>
<user>
</users>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment