Unix/Linux Go Back    


Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

win2008R2 using gnu grep/awk to find only the I instance out of the command

Windows & DOS: Issues & Discussions


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-26-2012
nextreme nextreme is offline
Registered User
 
Join Date: Jun 2012
Last Activity: 26 June 2012, 5:20 PM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
win2008R2 using gnu grep/awk to find only the I instance out of the command

Ok, running tsm on 2008R2, and I have the gnu awk and grep installed...I want to only capture inactive (I) 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


Code:
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

Moderator's Comments:
win2008R2 using gnu grep/awk to find only the I instance out of the command Code tags for code please.

Last edited by Corona688; 06-26-2012 at 02:46 PM..
Sponsored Links
    #2  
Old Unix and Linux 06-26-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 16 October 2017, 6:42 PM EDT
Location: Saskatchewan
Posts: 22,462
Thanks: 1,139
Thanked 4,259 Times in 3,933 Posts

Code:
awk '$1 >= 0 { print $6 }'

Sponsored Links
    #3  
Old Unix and Linux 06-26-2012
nextreme nextreme is offline
Registered User
 
Join Date: Jun 2012
Last Activity: 26 June 2012, 5:20 PM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
doesn't work, but here's more

Ok, so the first command gives me this:

Code:
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: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
 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 what i need with the additional awk parameters is the following:

Code:
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


Last edited by nextreme; 06-26-2012 at 03:21 PM..
    #4  
Old Unix and Linux 06-26-2012
nextreme nextreme is offline
Registered User
 
Join Date: Jun 2012
Last Activity: 26 June 2012, 5:20 PM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
output that I need to get would be this:

Code:
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

Where I need to key off of that damn (I). No changes, but grep just can't get er done...


Code:
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

---------- Post updated at 03:16 PM ---------- Previous update was at 03:14 PM ----------

Quote:
Originally Posted by Corona688 View Post
Code:
awk '$1 >= 0 { print $6 }'


this does not work...
Sponsored Links
    #5  
Old Unix and Linux 06-26-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 16 October 2017, 6:42 PM EDT
Location: Saskatchewan
Posts: 22,462
Thanks: 1,139
Thanked 4,259 Times in 3,933 Posts
Of course it doesn't. You hadn't explained what you wanted in detail enough for me to make the right guess.

Working on it.
Sponsored Links
    #6  
Old Unix and Linux 06-26-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 16 October 2017, 6:42 PM EDT
Location: Saskatchewan
Posts: 22,462
Thanks: 1,139
Thanked 4,259 Times in 3,933 Posts
So you just want to change the 6th column to "I" all the time?

You don't need 'grep' by the way.


Code:
awk '/0  B/ && ($1 >= 0) { $6="I"; print }'

Sponsored Links
    #7  
Old Unix and Linux 06-26-2012
nextreme nextreme is offline
Registered User
 
Join Date: Jun 2012
Last Activity: 26 June 2012, 5:20 PM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
no i do not want to change anything, what I need is to find only the files that have the $6 column that is set to "I". I would like to grep/awk/sed out all the entries marked with an "A" in the same field....

---------- Post updated at 03:26 PM ---------- Previous update was at 03:20 PM ----------

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
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How can I just grep one instance of a word in the file jcnewton13 Shell Programming and Scripting 8 06-18-2012 01:17 PM
grep for a string until instance of a space terrell Shell Programming and Scripting 6 11-27-2011 04:27 PM
grep second instance of same string scubasteve39 Shell Programming and Scripting 6 09-30-2011 01:14 PM
How to use grep & find command to find references to a particular file Gangam Shell Programming and Scripting 2 09-22-2011 03:52 AM
help in find and grep command ! ali560045 Shell Programming and Scripting 1 09-15-2008 05:46 AM



All times are GMT -4. The time now is 10:52 AM.