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
Post a Comment