I wrote this tool when working with a site system where I could execute Perl but not access SSH. This reproduced many of the advanced search operations typically handled with grep and avoided the need to manually update links and boilerplate code in hundreds of files scattered across various nested directories.
The tool consists of an HTML form (spdrsrch.htm - currently relies on manually entered directory paths), an executable that performs the search and displays results (spdrsrch.plx) and a few utility functions (spdrUtils.pm).
All fields are optional.
- target: strings to match, separatated by SPLIT
- replace: strings to replace the respective target strings, separated by /SPLIT/
- directories: directories to search (defaults to the full set - as currently coded, hard-coded to exclude sensitive directories)
- prerequisite: only apply search/replace to files containing one of these strings
''Search root:''
- Public root: the web root
- File system root: the highest folder available (on a shared server, /home/'''username''')
''Action:''
- Find: Search and return file names.
- Revert: Do not search, replace files with their autogenerated backups.
- Search, replace (saving backups with last version of each changed file), display number of changes per file.
''Prereq:''
- No Prerequisite: Apply search/replace to all files in directory set.
- Require: Only search those that have a prerequisite string.
- Exc;ide: Exclude files that have a string; search the rest.
''Seek:''
- Strict: Only search the named directories.
- Narrow:
- Spider: Search the named directories and their child directories.
''Type:'' Specify what file types to search. Of particular note:
- All: all file types
- Back: backup files (take care not to combine with Action: Replace)