Popular recipes tagged "meta:requires=fileinput" and "text" but not "text_processing"http://code.activestate.com/recipes/tags/meta:requires=fileinput+text-text_processing/2006-03-22T19:06:35-08:00ActiveState Code RecipesAWK like text processing (Python)
2006-03-22T19:06:35-08:00Ian Bygravehttp://code.activestate.com/recipes/users/2823999/http://code.activestate.com/recipes/475163-awk-like-text-processing/
<p style="color: grey">
Python
recipe 475163
by <a href="/recipes/users/2823999/">Ian Bygrave</a>
(<a href="/recipes/tags/text/">text</a>).
Revision 2.
</p>
<p>AWK is a text processing language that makes it easy to "search files for lines [...] that contain certain patterns. When a line matches one of the patterns, awk performs specified actions on that line." (GNU Awk User's Guide)
This recipe provides a way to do the same thing in python.</p>
Echo input with a time delay after each line (Python)
2005-11-02T10:07:35-08:00Edi Hancehttp://code.activestate.com/recipes/users/2650490/http://code.activestate.com/recipes/442518-echo-input-with-a-time-delay-after-each-line/
<p style="color: grey">
Python
recipe 442518
by <a href="/recipes/users/2650490/">Edi Hance</a>
(<a href="/recipes/tags/text/">text</a>).
</p>
<p>This script echos the input with a time delay after each line. The input can be from standard input or a list of files on the command line, like the Unix 'cat' command. The delay between lines is adjustable, and defaults to 1 second.</p>
Find and replace string in all files in a directory (Python)
2004-04-12T05:56:11-07:00Anthony Barkerhttp://code.activestate.com/recipes/users/122940/http://code.activestate.com/recipes/277753-find-and-replace-string-in-all-files-in-a-director/
<p style="color: grey">
Python
recipe 277753
by <a href="/recipes/users/122940/">Anthony Barker</a>
(<a href="/recipes/tags/text/">text</a>).
</p>
<p>A friend of mine needed to change the IP address in his DNS hosting bind configuration. Here is a quick script I wrote during lunch it interates all files in a directory and finds and replaces as string. In this case an IP address.</p>
Replace occurrence off string in files under directory tree (Python)
2002-04-18T12:37:37-07:00Ivan Brkanachttp://code.activestate.com/recipes/users/352905/http://code.activestate.com/recipes/120991-replace-occurrence-off-string-in-files-under-direc/
<p style="color: grey">
Python
recipe 120991
by <a href="/recipes/users/352905/">Ivan Brkanac</a>
(<a href="/recipes/tags/text/">text</a>).
Revision 2.
</p>
<p>This script go thru directory tree and looks for files off specified pattern, and then replace in those files string with new one, overwriting old file without backups</p>