Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

How can I emulate this unix command in power shell?

$
0
0

Hi

Below is a line that runs a Symantec command that will report on tapes in my tape library that has been written onto over the past 24 hours. This unix command searches for lines that contain the keyword FRAG in which these lines contains the LTO tape numbers. Then f9 is cut "contains the tape number", sorted and appended to the file /tmp/tapestoday.

Here's the unix command

/usr/openv/netbackup/bin/admincmd/bpimagelist -hoursago 24 |grep "^FRAG" |grep -v '/' |cut -d' ' -f9 | sort | uniq >> /tmp/tapestoday
echo '' >> /tmp/tapestoday

Here's the actual line that contains the tape number

FRAG 1 1 24146374 0 2 14 1 CIN045 usolysvrbkup01 65536 2 1393263899 1 0 *NULL* 1394473499 0 65537 0 0 0 1 0 1393267913 0 *NULL* *NULL*

How can I parse the output using windows powershell similarly to the above unix command and report on only array number 9 values in lines that contain the value FRAG? (I'm switching my Netbackup environment from Unix to Windows)

 

Thanks in advance.

Jeff

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles