Last active
October 21, 2015 13:42
-
-
Save mazuhl/070f79ac978efc303433 to your computer and use it in GitHub Desktop.
Command line bash functions to list odd/even lines form input file
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
# usage: odd numbers.txt | |
function odd() { | |
# print odd lines from file | |
awk 'NR%2==1 {print}' $1 | |
} | |
function even() { | |
# print even lines from file | |
awk 'NR%2==0 {print}' $1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment