Sometimes you want to find files with tabs (\t) within their content. With most greps this is a difficult task:
$ bash $ TAB=$(printf "\t") $ grep -Hn "$TAB" *
Using perl, there is another problem: If you want to see the line number, you usually use the special $. variable. But:
Because <> never does an explicit close, line numbers increase across ARGV files.
So you have to close ARGV manually:
$ perl -lne 'print "$ARGV:$.:$_" if /\t/ } continue { close ARGV if eo +f } {' *
-- Frank
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching tabs in a list of files
by davidrw (Prior) on Aug 25, 2005 at 12:42 UTC | |
|
Re: Searching tabs in a list of files
by ambrus (Abbot) on Aug 26, 2005 at 09:15 UTC |