grep(3)
[Home]
[Commands]
[Variables]
[Macro-Dev]
[Glossary]
NAME
SYNOPSIS
DESCRIPTION
grep performs a search for a pattern and displays all lines that contain that pattern within files in the current directory (or from starting-path) using built in MicroEmacs 2009 constructs rather than relying on any external executables such as grep(1). grep operates in exactly the same way as a traditional grep command line utility and uses a command line option sequence from the MicroEmacs 2009 command line. The grep-options allow recursive and regular expression searches, searching against the file modification time etc. The command line takes the user supplied grep-options, search-pattern, file-mask and starting-path. The output of the command is piped into the *grep* buffer.
grep-options
Defines the options that are specified on the command line, the default options may also be defined with the
find-setup(3) command invoked from the command line or from the the Tools menu. The grep-options are defined as follows:
-a
Re-read all out of date buffers, prevents a manual prompt, equivalent of Yes to all. This is the inverse of -o
-b
-B
Do not ignore binary files.
-d
List directories or grep in directory listings.
-D
Do not list directories or grep in directory listings.
-f
-F
Do not list/search files.
-g
File masks are regex (i.e. .*.emf)
-G
File masks are not regex (i.e. *.emf)
-i
Ignore search pattern case (case insensitive).
-I
Do not ignore search pattern case (case sensitive).
-l
Use existing buffer of loaded files.
-L
Do not use existing buffer of loaded files.
-m
Search pattern is a regular expression.
-M
Search pattern is not a regular expression.
-o
Do not re-read all out of date buffers, prevents a manual prompt, equivalent of No to all. This is the inverse of -a.
-p
-P
Starting path not specified
-r
Recurse into sub-directories
-R
Do not recurse into sub-directories
-S <size>
File size - less than or equal, the following size formats are supported:
-S <number> File size specified bytes.
-S <number>k File size specified in Kilobytes.
-s <size> File size greater than; supported size formats are the same as -S.
-T <time>
Modification time - older than, the following time formats are supported:
-T yy-mm-dd
-T yyyy-mm-dd
-T yyyy-mm-dd hh:mm:ss
-T days Offset time in days from midnight this morning, e.g. -T 0 would match all files not modified today.
-T days.hours[.minutes[.seconds]] Offset time in , e.g. -T 1.1.30 matches all files 25 hours and 30 minutes old.
Note that -T 1 is not the same as -T 1.0, except at midnight.
-t <time>
Modification time - newer than or equal, supported time formats are the same as -T.
-u
When used with -w, allows the file size limit of 100Mb to be disabled and strings are searched in files of any size.
-U
When used with -U, files are limited in size 100Mb otherwise they will not be searched.
-x
-X
file-mask
The files to search for e.g. *.txt
starting-path
The directory location where the search should commence. The default is the location of the current buffer.
find-setup invokes a dialogue and allows the default file-options to be specified when the find command is invoked.
NOTES
- Trying to make the command-line look like the standard UNIX grep(1) command may be more of a hindrance than a help because its not grep. No support is provided for options like -w, -l etc.
- The default when no options are given is -XGPRDfMIBL, default options may be set via the
find-setup(3) command (sets the /history/grep-com registry entry).
- Use of -d searches for <search-pattern> within the MicroEmacs 2009 directory listing.
- It may be advantageous to enable the -l option default using
find-setup(3).
SEE ALSO
(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12