Skip to content

Instantly share code, notes, and snippets.

@AruniRC
Created March 1, 2018 15:30
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 AruniRC/17820780bbda41bcee9ed0da77497f4f to your computer and use it in GitHub Desktop.
Save AruniRC/17820780bbda41bcee9ed0da77497f4f to your computer and use it in GitHub Desktop.
One-liners in bash that come in handy
# A dataset like WIDER-face has folders like:
# 0--Parade 21--Festival 33--Running
# 45--Balloonist 57--Angler 10--People_Marching
# This one-liner splits on '--', takes the second sub-string and gets rid of the '_'
# NOTE: example usage of awk
ls | awk -F'--' '{printf "%s\n", $2}' | awk -F'_' '{printf "%s %s\n", $1, $2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment