grepath is a command-line utility to effortlessly extract file paths from command outputs. It's especially useful in pipelines for processing compiler or lint tool outputs.
- Extract file paths from a given text.
- Optionally extract full paths including line and column numbers.
- Remove duplicate paths.
brew install kqito/tap/grepathcurl --proto '=https' --tlsv1.2 -LsSf https://github.com/kqito/grepath/releases/latest/download/grepath-installer.sh | shOr download directly from releases.
When we run grepath <file>, it reads the file and outputs the paths from the text.
For example, if you want to open error files in VSCode, you can use the following command:
grepath error.log | xargs -o codeYou can use grepath in command-line pipelines to filter paths from the output of other commands. Here is an example usage:
cat error.log | grepath | xargs -o codegrepath --help
Usage: grepath [<file>] [-d] [-l] [-u]
Args
Positional Arguments:
file file
Options:
-d, --debug help
--help display usage information- Support for windows paths
- Support for custom regex patterns
Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)