Last active
December 9, 2016 06:53
-
-
Save colstrom/9cf760272426d95e409a740f7a4f5f11 to your computer and use it in GitHub Desktop.
lines-after.fish: prints lines after a given pattern
This file contains hidden or 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
| name = lines-after | |
| author = Chris Olstrom | |
| license = MIT | |
| provides = fish/functions/lines-after | |
| requires | |
| command/awk | |
| fish/builtin/case | |
| fish/builtin/count | |
| fish/builtin/echo | |
| fish/builtin/end | |
| fish/builtin/function | |
| fish/builtin/return | |
| fish/builtin/switch |
This file contains hidden or 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
| function lines-after --argument pattern | |
| switch (count $argv) | |
| case 0 | |
| echo 'usage: lines-after <pattern>' | |
| return 100 | |
| case '*' | |
| awk "/$pattern/ { matched=NR; next } matched" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment