UNIX ack: Difference between revisions
Jump to navigation
Jump to search
Line 10: | Line 10: | ||
<pre>ack UserName --type=text WikiTrace*.txt </pre> | <pre>ack UserName --type=text WikiTrace*.txt </pre> | ||
Searches the txt files WikiTrace.txt for the occurence of ''Username''. | Searches the txt files WikiTrace.txt for the occurence of ''Username''. | ||
== Codeses == | |||
Use -f for working with big codesets | |||
<br>Ack does more than search files. ack -f --perl will create a list of all the Perl files in a tree, ideal for sending into xargs. For example: | |||
<pre> | |||
# Change all "this" to "that" in all Perl files in a tree. | |||
ack -f --perl | xargs perl -p -i -e's/this/that/g' | |||
</pre> | |||
== See also == | == See also == | ||
<span class="editsection">[[#content|top]]</span> | <span class="editsection">[[#content|top]]</span> |
Revision as of 18:11, 30 November 2012
ACK [1] is a 99% replacement for the grep and find combination. But not all commands are as obvious unfortunately.
Predefined types
ack --php wfHook
Searches through all the php-files for the occurence of the text 'wfHook'.
txt files
ack UserName --type=text WikiTrace*.txt
Searches the txt files WikiTrace.txt for the occurence of Username.
Codeses
Use -f for working with big codesets
Ack does more than search files. ack -f --perl will create a list of all the Perl files in a tree, ideal for sending into xargs. For example:
# Change all "this" to "that" in all Perl files in a tree. ack -f --perl | xargs perl -p -i -e's/this/that/g'
See also
Reference
- ↑ BetterThanGrep, ACK home page. ack is a tool like grep, optimized for programmers.