I am looking for some assistance on how i can filter certian lines out of an array.
Here is an example of what i am trying to do
I have an exclude array
$dbexclude = '.master.','.model.','.AdminDB.'
I have an array filled by a command
$dblist = & "C:\Program Files\Veritas\NetBackup\bin\bplist" -C $BackupHost -t 15 -s $BackupDate -R / | unique
Here is some sample lines from that array:
dbserver1.MSSQL7.dbserver1.db.old_MasterAuditDatabase.~.7.001of001.20160712114338…C:
dbserver1.MSSQL7.dbserver1.db.msdb.~.7.001of001.20160712114310…C:
dbserver1.MSSQL7.dbserver1.db.model.~.7.001of001.20160712114247…C:
dbserver1.MSSQL7.dbserver1.db.mhilltest.~.7.001of001.20160712114226…C:
dbserver1.MSSQL7.dbserver1.db.MASTER_AUDIT_DATABASE.~.7.001of001.20160712114149…C:
dbserver1.MSSQL7.dbserver1.db.master.~.7.001of001.20160712114126…C:
dbserver1.MSSQL7.dbserver1.db.Kronos_Punches.~.7.001of001.20160712114105…C:\
What i would like to see :
I would like to have a final array with values that would exclude matches form the exclude array so, from the example above the results should be:
dbserver1.MSSQL7.dbserver1.db.old_MasterAuditDatabase.~.7.001of001.20160712114338…C:
dbserver1.MSSQL7.dbserver1.db.msdb.~.7.001of001.20160712114310…C:
dbserver1.MSSQL7.dbserver1.db.mhilltest.~.7.001of001.20160712114226…C:
dbserver1.MSSQL7.dbserver1.db.MASTER_AUDIT_DATABASE.~.7.001of001.20160712114149…C:
dbserver1.MSSQL7.dbserver1.db.Kronos_Punches.~.7.001of001.20160712114105…C:\
Any thoughts on how i could accomplish this?