HELP VED_GETIT                                     Aaron Sloman Oct 1995

ENTER getit
ENTER getit q

    These commands can be used in a file produced by grep or ved_grep
    to go to a chosen file.


         CONTENTS - (Use <ENTER> g to access required sections)

 -- Introduction
 -- Precondition for use of ENTER getit after ENTER grep
 -- How to use ENTER getit
 -- Contexts in which it works
 -- How it works
 -- Quitting the current file: ENTER getit q

-- Introduction

The output of ved_grep (or grep, or egrep, or ggrep) can be a file
showing many occurrences of the search string as found in one or
more files. The "ENTER getit" command makes it easy to go to a specific
occurrence in a specific file.

This command is intended for use with the output of a file of the grep
family (e.g. egrep, ngrep, fgrep) or the "ENTER grep" ved command.
(See HELP * VED_GREP).


-- Precondition for use of ENTER getit after ENTER grep ---------------

This utility works on the output of ved_grep only if the variable
grep_leave_colons is set true.

If you intend to use ENTER getit regularly, you can put the following in
your vedinit.p file.

    global vars grep_leave_colons = true;

This makes the search command include a colon after each file name in
the output file. (See HELP * VED_GREP)



-- How to use ENTER getit

Run grep, e.g.
    ENTER grep prmishap $popautolib/*.p

The output file should specify several occurrences of the string
'prmishap' in more than one file.

Select a line containing the name of the file and the line you wish
to go to, and then do
    ENTER getit

This will then read in the file, and go to the first occurrence of the
line shown in the output of grep. If there is more than one such line
and you wish to find it, repeated search will be required (e.g. using
ESC /)


-- Contexts in which it works -----------------------------------------

The command works only when several files are found to include
occurrences of the search string. For only in that case does the output
include the name of the file in which the string was found.

The output may miss out file names if either the grep command is given
the name of only one file to search, or it is given a pattern which
happens to match only one file.

For example

    ENTER grep setenv .login*

might produce

    .login:    setenv OPENWINHOME /usr/openwin
    .login: setenv PRINTER lw33
    .login-:    setenv OPENWINHOME /usr/openwin
    .login-: setenv PRINTER lw33

The output file produced by ved_grep then has the file name followed by
a colon at the beginning of each line.

If the login- file is removed, then only one file is found and grep does
not tell you its name. The output might then be only:

    setenv OPENWINHOME /usr/openwin
    setenv PRINTER lw33

Then ved_getit will not work.


-- How it works -------------------------------------------------------

It extracts the file name (preceding the colon), and then uses the rest
of the line as a search string, assigned to vvedgotoplace, so that the
line containing that string will be found when VED starts up.
(See REF * VVEDGOTOPLACE)

In order to make the search mechanism work, occurrences of `@` and
of `/` in the string have to be preceded by an extra `@`, as described
in HELP VEDSEARCH

-- Quitting the current file: ENTER getit q ---------------------------

When you use ENTER getit, you can tell it to quit the file containing
the output of grep, before it goes to the selected file. To do this,
use the command:

    ENTER getit q

This is implemented using vedqget (See * vedqget)

See also
    HELP * VED_GREP
    MAN * egrep
    MAN * grep
or
    MAN * ggrep
    MAN * ngrep
        where available.

--- $poplocal/local/help/ved_getit
--- The University of Birmingham 1995.  --------------------------------
