1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This message will disappear after you have made at least 12 posts. Thank you for your cooperation.

win2008R2 using gnu grep/awk to find only inactive files

Discussion in 'Scripting' started by nextreme, Jun 26, 2012.

  1. nextreme

    nextreme New Member

    Joined:
    Jun 9, 2012
    Messages:
    10
    Likes Received:
    0
    Ok, running tsm on 2008R2, and I have the gnu awk and grep installed...I want to only capture inactive files inside of the backup...I can get this to work on linux, but because windows interprets " ' ` differently, i can't get it to print out right...Here's what I have:

    so basically here's the command

    F:\Program Files\Tivoli\TSM\baclient>dsmc q backup f:\* -subdir=yes -ina | grep "0 B" | awk "$1<=0"



    0 B 06/11/2012 13:55:09 STANDARD A \\virttsm\f$\db001
    0 B 06/11/2012 16:08:16 STANDARD A \\virttsm\f$\FILES
    0 B 06/11/2012 13:03:39 STANDARD I \\virttsm\f$\FILES
    0 B 06/11/2012 13:55:09 STANDARD A \\virttsm\f$\db001\SERVER1
    0 B 06/11/2012 13:55:09 DEFAULT A \\virttsm\f$\db001\SERVER1\SQLCRT.FLG
    0 B 06/11/2012 16:08:16 DEFAULT A \\virttsm\f$\FILES\dsmc
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (10)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (11)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (12)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (13)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (14)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (15)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (16)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (17)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (18)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (19)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (2)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (20)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (21)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (3)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (4)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (5)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (6)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (7)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (8)
    0 B 06/11/2012 13:03:39 DEFAULT A \\virttsm\f$\FILES\file_1888 - Copy (9)


    then inside of unix i would just print where field 6 == I, any ideas inside of windows so that I only capture the I column

    thxs in adv
     
  2.  
  3. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,226
    Likes Received:
    279
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    dsmc q backup f:\* -subdir=yes -ina | grep "0 B" | awk '{print $7}'
     
  4. nextreme

    nextreme New Member

    Joined:
    Jun 9, 2012
    Messages:
    10
    Likes Received:
    0
    I forgot to mention that I need the file and it's state...IE, i need to know what files are 0bytes, and in the inactive state..

    Here's the output I need:
    0 B 06/11/2012 13:03:39 STANDARD I \\virttsm\f$\FILES1
    0 B 06/11/2012 13:03:39 STANDARD I \\virttsm\f$\FILES2
    0 B 06/11/2012 13:03:39 STANDARD I \\virttsm\f$\FILES3
    0 B 06/11/2012 13:03:39 STANDARD I \\virttsm\f$\FILES4

    etc etc

    Here's the command to get the 0 byte files, but I need a way to key off of the Inactive column...

    dsmc q backup f:\* -subdir=yes -ina | grep "0 B" | awk "$1<=0"
     
    Last edited: Jun 26, 2012
  5. nextreme

    nextreme New Member

    Joined:
    Jun 9, 2012
    Messages:
    10
    Likes Received:
    0
    Here ya all go, remember this is for windows...
    Here it is, found on another forum, then modified...
    dsmc q backup f:\* -subdir=yes -ina | grep "0 B" | awk "$1<=0" | awk "{ if ($6 ~ /I/) print $0}"
    0 B 06/11/2012 13:03:39 STANDARD I \\virttsm\f$\FILES
    0 B 06/11/2012 13:03:39 STANDARD I \\virttsm\f$\FILES1
    0 B 06/11/2012 13:03:39 STANDARD I \\virttsm\f$\FILES2
    0 B 06/11/2012 13:03:39 STANDARD I \\virttsm\f$\FILES3
     

Share This Page