--
You received this message because you are subscribed to the Google Groups "Revelation Password Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to revelation-pass...@googlegroups.com.
To post to this group, send email to revelatio...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/revelation-password/CAHAJJJpfowZmLDZvZZWy7DvT-1H8Ebni%2BU1OP7Er2i8dC5Oirw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
#!/bin/sh
# Combining *find* with the *file* command don't give a good result as the
# revelation files mime type is "application/octet-stream" and it's not a
# unique mime-type.
# How can I use the linux 'find' command to show all revelation password files?
# [posted in Google Groups "Revelation"]
# find . -type f | while read -r line; do head -c 6 "$line" | xxd -p && echo "$line"; done | grep -A 1 72766c
# explanation
#-------------
# 'find' selects each regular file in the current working
# directory (and its subdirectories), printing its name.
# for each filename
# 'head' extracts the 1st 6 bytes from that file
# 'xxd' converts them to hexdump format,
# 'printf' prefixes the dumped signature to the
# filename from 'find', separated by a blank
# 'grep' only passes on lines that begin with '72766c',
# the signature for revelation password files
# 'cut' strips the signature, leaving only the
# filename from 'find'
# Clearly, this sequence can be generalized for other
# types of data files by supplying a signature as a
# parameter.
# pretty-print as multi-line
# add parameter for signature
# all params in CAPS
# collapse to one line per file found and
# replace 'echo' with 'printf'
SIG='72766c'
find . -type f \
| while read -r LINE; do \
printf "%s %s\n" \
$(head -c 6 "$LINE" | xxd -p) \
"$LINE"; \
done \
| grep "$SIG" \
| cut -d " " -f 2-