Skip to main content
fixed type
Source Link
fheub
  • 553
  • 1
  • 4
  • 14

The combination of grep and find is in many cases ack (betterthangrep.com):

ack [OPTION]... PATTERN [FILE]

For your example, consider using

ack --shell word /

Notes

ack

  • searches (by default) recursively, but
  • ignores (by default) directories from common version control systems, e.g. .git, .hg, .svn, ...
  • can easily narrow down your results by using filters for common file types (see below for distinct file name patterns)
  • has a grep-like syntax and the same/similar arguments like -i for "ignore case" etc.
  • may be called ack-grep on your system (on Debian based distros, if I remember correctly)

File name patterns

The option --shell is short for --type=shell and includes several file types: currently .sh .bash .csh .tcsh .ksh .zsh according to

ack --help-types

If you want only .sh files, you have to define (add) your own type sh and use this filter (--sh) like this:

ack word --type-add=sh=.sh --sh /

This sounds a bit complicated, but allows recuresiverecursive search for .sh files below /. For a local search (without specifying the starting directory, e.g. \) it would be easier:

ack word *.sh

The combination of grep and find is in many cases ack (betterthangrep.com):

ack [OPTION]... PATTERN [FILE]

For your example, consider using

ack --shell word /

Notes

ack

  • searches (by default) recursively, but
  • ignores (by default) directories from common version control systems, e.g. .git, .hg, .svn, ...
  • can easily narrow down your results by using filters for common file types (see below for distinct file name patterns)
  • has a grep-like syntax and the same/similar arguments like -i for "ignore case" etc.
  • may be called ack-grep on your system (on Debian based distros, if I remember correctly)

File name patterns

The option --shell is short for --type=shell and includes several file types: currently .sh .bash .csh .tcsh .ksh .zsh according to

ack --help-types

If you want only .sh files, you have to define (add) your own type sh and use this filter (--sh) like this:

ack word --type-add=sh=.sh --sh /

This sounds a bit complicated, but allows recuresive search for .sh files below /. For a local search (without specifying the starting directory, e.g. \) it would be easier:

ack word *.sh

The combination of grep and find is in many cases ack (betterthangrep.com):

ack [OPTION]... PATTERN [FILE]

For your example, consider using

ack --shell word /

Notes

ack

  • searches (by default) recursively, but
  • ignores (by default) directories from common version control systems, e.g. .git, .hg, .svn, ...
  • can easily narrow down your results by using filters for common file types (see below for distinct file name patterns)
  • has a grep-like syntax and the same/similar arguments like -i for "ignore case" etc.
  • may be called ack-grep on your system (on Debian based distros, if I remember correctly)

File name patterns

The option --shell is short for --type=shell and includes several file types: currently .sh .bash .csh .tcsh .ksh .zsh according to

ack --help-types

If you want only .sh files, you have to define (add) your own type sh and use this filter (--sh) like this:

ack word --type-add=sh=.sh --sh /

This sounds a bit complicated, but allows recursive search for .sh files below /. For a local search (without specifying the starting directory, e.g. \) it would be easier:

ack word *.sh
Source Link
fheub
  • 553
  • 1
  • 4
  • 14

The combination of grep and find is in many cases ack (betterthangrep.com):

ack [OPTION]... PATTERN [FILE]

For your example, consider using

ack --shell word /

Notes

ack

  • searches (by default) recursively, but
  • ignores (by default) directories from common version control systems, e.g. .git, .hg, .svn, ...
  • can easily narrow down your results by using filters for common file types (see below for distinct file name patterns)
  • has a grep-like syntax and the same/similar arguments like -i for "ignore case" etc.
  • may be called ack-grep on your system (on Debian based distros, if I remember correctly)

File name patterns

The option --shell is short for --type=shell and includes several file types: currently .sh .bash .csh .tcsh .ksh .zsh according to

ack --help-types

If you want only .sh files, you have to define (add) your own type sh and use this filter (--sh) like this:

ack word --type-add=sh=.sh --sh /

This sounds a bit complicated, but allows recuresive search for .sh files below /. For a local search (without specifying the starting directory, e.g. \) it would be easier:

ack word *.sh