ClearCase delete view private files only

99封情书 提交于 2019-12-01 08:40:41
VonC

You are right, none of those two soution would work:

 cleartool ls -rec | grep -v "Rule:" | grep -v "eclipsed" | grep -v "-->"  | xargs rm -v

    cleartool lsprivate | grep -v "eclipsed" | xargs rm -v

Source: my old answer at "Command to find all view private files in the current directory recursively".

An lsprivate alone lists eclipsed file like any other private file:

M:\yourDynView\yourVob\aDir\>ct lsprivate

M:\yourDynView\yourVob\aDir\aFile.vsd
M:\yourDynView\yourVob\aDir\aPrivateFile

But, an lsprivate -l list eclipsed file twice:

M:\yourDynView\YourVob>ct lsprivate -long

view private object    M:\yourDynView\yourVob\aDir\aFile.vsd
file element           M:\yourDynView\yourVob\aDir\aFile.vsd@@ [eclipsed]
view private object    M:\yourDynView\yourVob\aDir\aPrivateFile

So you need three passes

  • one to generate that cleartool lsprivate -l
  • one to remove any line above a line which contains eclipsed
  • one to read that file and delete the remaining private files listed in that file

The second step could be (loosely tested after this thread)

gawk "{if ((NR!=1)&&($0!~/eclipsed/)) {if ($lastlin!~/eclipsed/) {print astlin};lastlin=$0} } END{print lastlin} " s

With 's' the file containing the result of a cleartool lsprivate -l.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!