Shell Commands/Search

From MorphOS Library

< Shell Commands

Search - Searches a file or pattern for a string

FROM/M, SEARCH/A, ALL/S, NONUM/S, QUIET/S, QUICK/S, FILE/S, PATTERN/S, CASE/S

FROM    - Directory or file where to search                                            
SEARCH  - Search string
ALL     - if FROM is a Dir, will process subdirectories as well
NONUM   - Do not print the line numbers with the string
QUIET   - Searches quietly; file names being searched are not displayed
QUICK   - Use a more compact output format
FILE    - Looks for a file by the specified name,
          rather than for a string in the file
PATTERN - Only files matching this pattern will be processed
CASE    - Search is case-sensitive (default=NO)

NOTE: Search leaves a 0 in the condition flag if the object is found, and a 5 (WARN) otherwise. To abandon the search of the current file and continue to the next file, if any, press Ctrl+D. Search is aborted when Ctrl+C is pressed.

Examples:

  MorphOS:> search c:help $VER
  1083 VER: Help [MOS] 0.6 (19.12.2004)© 2004 by Nicolas Ramz

  MorphOS> search utilities #?.info file
  MorphOS:Utilities/Calculator.info
  MorphOS:Utilities/Snoopium.info
  MorphOS:Utilities/TaskManager.info