Skip to content

Instantly share code, notes, and snippets.

@melmatsuoka
Last active May 18, 2018 01:45
Show Gist options
  • Save melmatsuoka/8a9b866170e5f7f8b18e1faf519a7acf to your computer and use it in GitHub Desktop.
Save melmatsuoka/8a9b866170e5f7f8b18e1faf519a7acf to your computer and use it in GitHub Desktop.
Extract original filename of renamed .R3D file
#!/bin/bash
#
# Extract the original filename of renamed .R3D file. This is useful for reconstructing
# R3D files restored from a data-recovery operation from an HFS+ drive.
#
# note: the “-m 1” argument tells grep to stop after the first returned match.
# The pipe to "cut” is a dumb way to trim the leading “V” character on the returned filename
strings "FILE.R3D" | grep -m 1 -E "^.*[A-Z][0-9]{3}_[A-Z][0-9]{3}_[0-9]{4}[A-Z0-9]{2}_[0-9]{3}.R3D" | cut -c2-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment