Skip to content

Instantly share code, notes, and snippets.

@mazuhl
Last active October 21, 2015 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazuhl/070f79ac978efc303433 to your computer and use it in GitHub Desktop.
Save mazuhl/070f79ac978efc303433 to your computer and use it in GitHub Desktop.
Command line bash functions to list odd/even lines form input file
# 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