BackupPC-users

[BackupPC-users] FYI: One liner to print out a single specific attrib for all files

2009-11-11 12:26:59
Subject: [BackupPC-users] FYI: One liner to print out a single specific attrib for all files
From: "Jeffrey J. Kosowsky" <backuppc AT kosowsky DOT org>
To: General list for user discussion <backuppc-users AT lists.sourceforge DOT net>
Date: Wed, 11 Nov 2009 12:22:32 -0500
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>

------------------------------------------------------------------------------
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/

<Prev in Thread] Current Thread [Next in Thread>