Skip to content

Instantly share code, notes, and snippets.

@seyonv
Created July 29, 2016 20:56
Show Gist options
  • Save seyonv/ceea9b9780128720fbcffd58754c5038 to your computer and use it in GitHub Desktop.
Save seyonv/ceea9b9780128720fbcffd58754c5038 to your computer and use it in GitHub Desktop.
Using sed to separate the name & extension parts of a string
FILE_NAME=$(echo "$IN_FILE" | sed 's/\([a-zA-Z0-9_]*\).[a-zA-Z0-9]*/\1/')
FILE_EXT=$(echo "$IN_FILE" | sed 's/[a-zA-Z0-9_]*\(.[a-zA-Z0-9]*\)/\1/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment