UUID confusion revisited

Nils Kassube kassube at gmx.net
Tue Mar 25 11:30:47 UTC 2008

SYNass IT Ubuntu / Linux wrote:
> Unfortunately partial only: It displays on the screen but the two
> individual files UUIDcom_Drives.ymmdd_HHMMSS &
> UUIDcomp_Mounts.ymmdd_HHMMSS are no more on the Desktop now !!

It looks as if there are spaces in your filenames, but maybe that is
a fault of our email programs. If there are spaces in the filenames,
they must be quoted, or even better, avoid spaces in filenames.
Furthermore there could be a problem with the file names because the
date command is run several times. Then maybe the time is different
from the first to the last date command. You could try this (untested)
modified version:

d="$(date '+%y%m%d_%H%M%S')"
ls -l /dev/disk/by-uuid/ |\
awk '{print $10, "UUID="$8}' | sort |\
awk -F"/" '{print $3}' > "$Dr"
cat /etc/fstab |\
sed -e '/.*\/dev.*$/N;s/\n */ /' |\
sed -e 's;^# *;;' |\
sed -e 's/\(^\/dev\/[a-z0-9]* UUID=[a-z0-9]\{8\}-[a-z0-9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]\{12\}\).*/\1/' |\
sed -e '/^\/dev\/.*UUID.*/!d' |\
sed -e 's/^\/dev\///' > "$Mo"
join -a 1 "$Dr" "$Mo"

Hopefully, I got that km long line correct :)


More information about the ubuntu-users mailing list