Skip to content

Instantly share code, notes, and snippets.

@ravnoor
Last active November 8, 2017 17:44
Show Gist options
  • Save ravnoor/b70651b75ec2ecda697b4dc3757898b8 to your computer and use it in GitHub Desktop.
Save ravnoor/b70651b75ec2ecda697b4dc3757898b8 to your computer and use it in GitHub Desktop.
list, sort and unique to get directory name from filenames
ls -1 | awk -F'_' '{print $1 $2}' | sort -u
# FLP_001_t2.nii
# FLP_001_t1_nii
# FLP_004_t2.nii
# FLP_004_t1.nii
# ||
# ||
# FLP_001
# FLP_004
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment