Replace string in a list which start with Security and end ) – installed aplication RRS feed

  • Question

  • I have  exported a list of installed application from a lot of computers. Problem is, that i would like to remove all Windows updates, etc that are in a list..

    List is build like :

    Server1, Security…9), Adobe…,7zip,app1,Secur..7)

    Server2, Security…2), Adobe…,7zip,app1,Secur..3),Office

    Server2, Adobe…,7zip,app1,Secur..3),Office,bdm

    Basically, i can not replace  »Security…..)«

    If i try $str = $str -replace 'Security[^)]',',', i get  output

    Server1, …9), Adobe…,7zip,app1,..7)

    I would like to get output similar like Server1, ,Adobe…,7zip,app1)

    Tuesday, July 21, 2015 11:18 AM

All replies

  • $s='Server1, Security…9), Adobe…,7zip,app1,Secur..7)' -replace 'Security\S\d\)',''
    $s -replace 'Secur\.+\d',''


    Tuesday, July 21, 2015 11:44 AM
  • 'Server1, Security…9), Adobe…,7zip,app1,Secur..7)' -match'Security\S\d\)'  --> True

    'Security Update for Windows Server 2003 (KB2229593), Security Update for Windows Server 2003 (KB2347290), Security Update for Windows Server 2003 (KB2378111), Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.4148, Microsoft Silverlight 5.1' -match' Security\S\d\)'  ---> False

    Tuesday, July 21, 2015 1:35 PM
  • I don't think you really have text.  You have dumped the security updates list incorrectly and now the formatting is munged.

    It is not likely that you can fix it.

    Where did you get this file?


    Tuesday, July 21, 2015 2:11 PM
  • Yes it is a dump.

    Each line consist of what is installed on server. Every entry is delimited with »,« .

    Basically i have dump of circa 250 servers from windows server 2000, to windows server 2012 R2.

    I would like to remove everything that have anything to do with windows update.  I would like to clean up a list, and I’m doing wrong something basic….

    Tuesday, July 21, 2015 5:16 PM
  • What is it that you are trying to get by extracting this file?  What created this file?

    We can get all updates by name in may very easy ways.


    Tuesday, July 21, 2015 9:57 PM