Skip to content

Instantly share code, notes, and snippets.

@gongzhitaao
Created October 23, 2013 02:43
Show Gist options
  • Save gongzhitaao/7111795 to your computer and use it in GitHub Desktop.
Save gongzhitaao/7111795 to your computer and use it in GitHub Desktop.
sed one-liner
# input:
# 1 1
# 2 2
# 3 3
# 4 4
# 5 5
# 6 6
# 7 7
# output:
# 1
# 4
# 7
sed '1~3 !d;s/^\(.*\)\s\+\1/\1/' file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment