問題タブ [select-string]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
180 参照

split - Grep - PowerShell スタイル

「grep」した後、PowerShell で文字列を分割するのに苦労しています。1 時間ごとの Web ログから最大 10 個の値を取得したいと考えています。

「Grep」は機能しますが、分割できません。

PS D:\Work\ps> D:\Work\ps\test\grep.ps1 [Microsoft.PowerShell.Commands.MatchInfo] に「split」という名前のメソッドが含まれていないため、メソッドの呼び出しに失敗しました。D:\Work\ps\test\grep.ps1:8 で char:2 + $string.split($separator,0, $option) + ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) []、RuntimeException + FullyQualifiedErrorId : MethodNotFound

https://communary.net/2014/11/10/grep-the-powershell-way/ https://blogs.technet.microsoft.com/heyscriptingguy/2014/07/17/using-the-split-method- in-powershell/

注意することは重要です:私はすでにエスケープしました:「実行:」私が試したいくつかのこと:

としても:

ありがとう!

0 投票する
2 に答える
12246 参照

powershell - テキストファイルの行の一部のみを表示するPowershellのSelect-String。全体を表示する必要があります

大きな .txt ログ ファイルで短い文字列 "SRVE0242I:" をチェックする単純な PS スクリプトを作成しようとしています。

ただし、出力では、次のみが表示されます。


[28/06/17 13:48:27:839] 00000020 ServletWrappe I SRVE0242I: [ユーザー] [ユーザー] [com_xxxxxxx_...

フルラインではありません。これで引くキャラクター数に制限はありますか?Select-String コマンドレットの制限に関する情報が見つかりません。これを行うためのより良い方法はありますか?a)行のリストで見出し「行」を引き出し(このような単純な出力の表の書式設定を実際に作成したくない)、b)行全体を取得します私が情報を引き出すとき?