Last active
November 27, 2021 22:52
-
-
Save thingsiplay/fe6925209de0ef0c082a68a41025deef to your computer and use it in GitHub Desktop.
nogrep - Search matching lines with sed and print their non matching part of the lines.
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/sh | |
# Search matching lines with sed and print their non matching part of the lines. | |
# Usage: | |
# nogrep filter [sed_options] | |
# Examples: | |
# nogrep 'output' changelog.txt | |
# ls | nogrep '\(J\).*$' -E | |
filter=$1 | |
shift 1 | |
sed -n "/$filter/s/$filter//p" $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment