佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > Powershell小技巧之復(fù)合篩選

Powershell小技巧之復(fù)合篩選

熱門標(biāo)簽:地方門戶網(wǎng)站 百度競(jìng)價(jià)排名 Linux服務(wù)器 鐵路電話系統(tǒng) 呼叫中心市場(chǎng)需求 網(wǎng)站排名優(yōu)化 服務(wù)外包 AI電銷

當(dāng)你分析文本日志或篩選不通類型的信息時(shí),你通常要使用 Where-Object。這里有一個(gè)通用腳本來(lái)說(shuō)明復(fù)合篩選:

# logical AND filter for ALL keywords 
Get-Content -Path C:\windows\WindowsUpdate.log | 
 Where-Object { $_ -like '*successfully installed*' } | 
 Where-Object { $_ -like '*framework*' } | 
 Out-GridView
 
# above example can also be written in one line 
# by using the -and operator 
# the resulting code is NOT faster, though, just harder to read 
Get-Content -Path C:\windows\WindowsUpdate.log | 
 Where-Object { ($_ -like '*successfully installed*') -and ($_ -like '*framework*') } | 
 Out-GridView
 
# logical -or (either condition is met) can only be applied in one line 
Get-Content -Path C:\windows\WindowsUpdate.log | 
 Where-Object { ($_ -like '*successfully installed*') -or ($_ -like '*framework*') } | 
 Out-GridView
您可能感興趣的文章:
  • PowerShell中使用Get-ChildItem命令讀取目錄、文件列表使用例子和小技巧
  • Powershell小技巧之使用-F方法帶入數(shù)據(jù)
  • Powershell小技巧之使用Copy-Item添加程序到開(kāi)機(jī)啟動(dòng)
  • Powershell小技巧之通過(guò)EventLog查看近期電腦開(kāi)機(jī)和關(guān)機(jī)時(shí)間
  • Powershell小技巧之使用Get-ChildItem得到指定擴(kuò)展名文件

標(biāo)簽:仙桃 黃山 崇左 蘭州 湘潭 湖南 銅川 衡水

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Powershell小技巧之復(fù)合篩選》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    江都市| 兴宁市| 交口县| 措美县| 嘉义市| 凯里市| 四会市| 灌南县| 和田县| 漳平市| 长武县| 密山市| 金阳县| 寻甸| 明光市| 惠东县| 邢台市| 贵溪市| 米脂县| 右玉县| 濮阳市| 甘孜县| 白银市| 栖霞市| 清丰县| 乐安县| 安达市| 兴隆县| 达日县| 元阳县| 肥东县| 莆田市| 杂多县| 东海县| 大安市| 阳朔县| 广平县| 龙川县| 湟源县| 通海县| 思茅市|