|
a command line
Depeche View
free external tools,
java sources
cpp sources
articles
|
- download the free swiss file knife base from sourceforge. - unpack the tool using winzip or unzip. - open the Windows Command Line or a Linux shell.
sfk find [opts] singledir pattern [pattern2] [pattern3] ... [-names]
sfk grep [opts] -pat pattern [pattern2] -dir dir1 [-file] [.ext1] ...
case-insensitive pattern search for text and binary. if multiple
patterns are given, then only areas containing ALL are listed.
by default, find tries to autodetect if a file is text or binary.
with binary files, the distance between patterns found must be <80
chars to be listed as a hit.
options
-text process only text files, skip all binary files.
finds patterns also over long lines, avoiding line breaks.
-bin do not autodetect file content, process all as binary.
can also be used for floating text files (one linefeed per
paragraph, not per line). may produce unwanted line breaks
with short-lined text.
-hidden include hidden and system files.
-c case-sensitive search (not default).
-lnum list line numbers of hits.
-nocol disable color highlighting of output (sfk help colors).
-names list only names of files containing at least one hit.
-count list no. of matching lines per file. implies -names.
requires -text option, cannot be used with binary files.
-quiet do not show "scan" progress info.
-pure do not list filenames, list only text hits without indent.
default when specifying a single file as first parameter.
-verbose tells in detail what find is actually searching for.
-nocconv disable umlaut and accent character conversions during
output to console. "sfk help opt" for details.
-firsthit show only first matching result per file.
-justrc print nothing to terminal, just set return code.
pattern support:
no wildcards or slash patterns are supported, with one exception:
if you need to find patterns starting with "-" or "+", prefix
them with backslash \ to avoid misinterpretation as options.
return codes for batch files
0 = no matches, 1 = matches found, >1 = major error occurred.
see also "sfk help opt" on how to influence error processing.
aliases
"sfk grep" is the same as "sfk find".
"sfk ftext" is the same as "sfk find -text".
see also
sfk filter flexible pattern finding, for text files only.
sfk hexfind an optimized binary file pattern finder.
sfk view a high speed GUI text file search tool. searches
words as you type, or by clicking on them.
examples
sfk find . foo bar include
search all files in current dir for the words foo+bar+include.
note that the short form syntax supports one directory name,
and any number of text patterns, but no file name patterns.
sfk find -pat text1 text2 -dir src1 src2 -file .cpp .hpp
searches within the specified directories and file masks.
sfk list src +find -verbose \-pat \\-foo \+list
find lines containing words "-pat", "\-foo" and "+list"
in all files of directory src, with verbose search infos.
sfk find testfiles class +view
search "class" within "testfiles", and show results
interactively in Depeche View ("sfk view" for details).
sfk filter -+-pat -+\-foo -++list -dir src
alternative search, done with sfk filter, on textfiles.
sfk hexfind src /-pat/ /-foo/ /+list/
alternative search with sfk hexfind. patterns are OR combined.
example output:
sfk find testfiles bardriver
testfiles\FooBank\BarDriver\include\BarDriver.hpp :
class BarDriver
BarDriver ( );
~BarDriver ( );
testfiles\FooBank\BarDriver\source\BarDriver.cpp :
BarDriver::BarDriver( )
BarDriver::~BarDriver( )
void BarDriver::runDrawThread( )
testfiles\FooBank\DB\source\DBController.cpp :
#include "FooBank/BarDriver/include/BarDriver.hpp"
testfiles\FooBank\GUI\source\FooGUI.cpp :
#include "FooBank/BarDriver/include/BarBottle.hpp"
testfiles\Formats\10-dir-list.txt :
C:\sfk\testfiles\FooBank\BarDriver
C:\sfk\testfiles\FooBank\BarDriver\include
C:\sfk\testfiles\FooBank\BarDriver\source
C:\sfk\testfiles\FooBank\BarDriver\include\BarBottle.hpp
C:\sfk\testfiles\FooBank\BarDriver\include\BarDriver.hpp
C:\sfk\testfiles\FooBank\BarDriver\include\BarGlass.hpp
testfiles\Formats\12-foo-jam.txt :
testfiles\FooBank\BarDriver\include\BarBottle.hpp
testfiles\FooBank\BarDriver\include\BarDriver.hpp
class BarDriver
BarDriver ( );
~BarDriver ( );
testfiles\FooBank\BarDriver\include\BarGlass.hpp
testfiles\FooBank\BarDriver\include\BarMug.hpp
testfiles\FooBank\BarDriver\source\BarBottle.cpp
testfiles\FooBank\BarDriver\source\BarDriver.cpp
BarDriver::BarDriver( )
BarDriver::~BarDriver( )
void BarDriver::runDrawThread( )
testfiles\FooBank\BarDriver\source\BarGlass.cpp
testfiles\FooBank\BarDriver\source\BarMug.cpp
see also:
finding classfiles using sfk list, find and alias.
sfk is a free open-source tool, running instantly without installation efforts. no DLL's, no registry changes - just get sfk.exe from the zip package and use it (binaries for windows, linux and mac are included). read more about all sfk functions here.
|
|