Wanted: Help translating bash script into powertools


i'm using cleartool program clear case. can me translate bash powershell?

cleartool lsview | grep -i `uname -n` | grep -v "viewstorage\\|vgr_tools_sv" | cut -f 3 -d ' '

"cleartool lsview" produces acres of output , interested in lines contain name of computer. here attempt not work:

cleartool lsview | where-object { $_ "*$env:computername*" }

then need pipe where-object again exclude lines contain viewstorage or vgr_tools_sv.

then need extract third field delimited spaces.

then each line contain clear case view.  each view want call bat file build view.

can me write powershell script?

thanks

siegfried


siegfried heintze

cleartool lsview | select-string $env:computername |? { -not($_ -match "viewstorage|vgr_tools_sv") } | % { $_ -replace "\s*(.+)\s$cn.+", '$1' }  | foreach-object{ .\build_view.bat $_ }

this solution. asking foreach-object feature , found thru bing searching.

see http://stackoverflow.com/questions/6395875/how-to-select-a-specific-column 

i hoping syntax more cygwin/linux/opensource cut (which, come think if it, still have used) replace works too.

can me understand $cn in code above? maybe link?

it works! thank everyone.


siegfried heintze



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file