Last active
August 29, 2015 14:05
-
-
Save cpburnz/d54afa685fb25b99c8e1 to your computer and use it in GitHub Desktop.
From a bash shell, grep file names received from STDIN. The file names may contain spaces.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# From a bash shell, grep file names received from STDIN. The file names may | |
# contain spaces. | |
# | |
# Author: Caleb P. Burns | |
# License: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
# Version: 1.0.0 | |
# 1. Find the files to grep. | |
# 2. Sort them. | |
# 3. Grep each file's contents. | |
find ... -print0 | sort | xargs -0 grep --color=always ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment