Re: [BackupPC-users] FYI: One liner to print out a single specific attrib for all files
2009-11-11 12:47:44
Jeffrey J. Kosowsky wrote at about 12:22:32 -0500 on Wednesday, November 11,
2009:
> Sometimes when troubleshooting, I want to find all files with a
> certain attribute. So you can use a modified version of this (very
> inefficient) bash/perl one liner to do it. (of course it would have
> been much more efficient to write a separate perl script but I like
> one-liner challenges sometimes)...
>
> The following example prints out the 'type' of each file in the
> backup:
>
> find /var/lib/BackupPC/pc/machine/backnumber -name "attrib" | ( while IFS=
> read -r FILE ; do sudo -u backuppc
> /usr/share/BackupPC/bin/BackupPC_attribPrint "$FILE" | head -n -2 | perl -s
> -ne "$/=' }';print \"\${-name}\$1 \$2\n\" if \/'([^']*)' => {.*'type' =>
> ([0-9])+/s" -- --name="${FILE%attrib}" - | tail -n +2; done)
>
> The output format is:
> <full file path name> <type>
>
And if you want to unmangle the paths and remove the
/var/lib/... prefix, try this:
find /var/lib/BackupPC/pc/machine/backnumber -name "attrib" | ( while IFS= read
-r FILE ; do sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_attribPrint
"$FILE" | head -n -2 | perl -s -ne "$/=' }';if(\/'([^']*)' => {.*'type' =>
([0-9])+/s){\${-name} =~ s|/var/lib/BackupPC/pc/[^/]*/[^/]*||; \${-name} =~
s|/f|/|g; print \"\${-name}\$1 \$2\n\"}" -- --name="${FILE%attrib}" - | tail -n
+2; done)
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
|
|
|