This file contains 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 -H -r string_to_find directory_to_search | cut -d: -f1 | sort | uniq | tr "\n" " " |
This file contains 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
sed -e 's/{% url \([^ %]*\)\(.*\)%}/{% url "\1"\2%}/g' file.in > file.out |
This file contains 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 -nri '% url' site/templates | cut -d : -f 1 | sort | uniq | tr "\n" " " |
This file contains 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
<?xml version=”1.0"?> | |
<membership> | |
<users> | |
<user name=”john”/> | |
<user name=”charles”/> | |
<user name=”peter”/> | |
</users> | |
This file contains 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
from xml.etree import ElementTree | |
from xml.etree.ElementTree import Element | |
from xml.etree.ElementTree import SubElement | |
# <membership/> | |
membership = Element( 'membership' ) | |
# <membership><users/> | |
users = SubElement( membership, 'users' ) |
This file contains 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
output_file = open( 'membership.xml', 'w' ) | |
output_file.write( '<?xml version="1.0"?>' ) | |
output_file.write( ElementTree.tostring( membership ) ) | |
output_file.close() |