Ack 中的filtertype

The ack manual says:
 
 
       −−ignore−file=FILTERTYPE:FILTERARGS
           Ignore files matching FILTERTYPE:FILTERARGS.  The filters are
           specified identically to file type filters as seen in "Defining
           your own types".
 
Defining your own types
       ack allows you to define your own types in addition to the predefined
       types. This is done with command line options that are best put into an
       .ackrc file − then you do not have to define your types over and over
       again. In the following examples the options will always be shown on
       one command line so that they can be easily copy & pasted.
 
       ack −−perl foo searches for foo in all perl files. ack −−help=types
       tells you, that perl files are files ending in .pl, .pm, .pod or .t. So
       what if you would like to include .xs files as well when searching for
       −−perl files? ack −−type−add perl:ext:xs −−perl foo does this for you.
       −−type−add appends additional extensions to an existing type.
 
       If you want to define a new type, or completely redefine an existing
       type, then use −−type−set. ack −−type−set eiffel:ext:e,eiffel defines
       the type eiffel to include files with the extensions .e or .eiffel. So
       to search for all eiffel files containing the word Bertrand use ack
       −−type−set eiffel:ext:e,eiffel −−eiffel Bertrand.  As usual, you can
       also write −−type=eiffel instead of −−eiffel. Negation also works, so
       −−noeiffel excludes all eiffel files from a search. Redefining also
       works: ack −−type−set cc:ext:c,h and .xs files no longer belong to the
       type cc.
 
       When defining your own types in the .ackrc file you have to use the
       following:
 
         −−type−set=eiffel:ext:e,eiffel
 
       or writing on separate lines
 
         −−type−set
         eiffel:ext:e,eiffel
 
       The following does NOT work in the .ackrc file:
 
         −−type−set eiffel:ext:e,eiffel
 
       In order to see all currently defined types, use −−help−types, e.g.
       ack −−type−set backup:ext:bak −−type−add perl:ext:perl −−help−types
 
       In addition to filtering based on extension (like ack 1.x allowed), ack
       2 offers additional filter types.  The generic syntax is −−type−set
       TYPE:FILTER:FILTERARGS; FILTERARGS depends on the value of FILTER.
 
       is:FILENAME
           is filters match the target filename exactly.  It takes exactly one
           argument, which is the name of the file to match.
 
           Example:
 
               −−type−set make:is:Makefile
 
       ext:EXTENSION[,EXTENSION2[,...]]
           ext filters match the extension of the target file against a list
           of extensions.  No leading dot is needed for the extensions.
 
           Example:
 
               −−type−set perl:ext:pl,pm,t
 
       match:PATTERN
           match filters match the target filename against a regular
           expression.  The regular expression is made case insensitive for
           the search.
 
           Example:
 
               −−type−set make:match:/(gnu)?makefile/
 
       firstlinematch:PATTERN
           firstlinematch matches the first line of the target file against a
           regular expression.  Like match, the regular expression is made
           case insensitive.
 
           Example:
 
               −−type−add perl:firstlinematch:/perl/
 
       More filter types may be made available in the future.
 
 
 
Thanks,

猜你喜欢

转载自hexlee.iteye.com/blog/1907919
ACK