以下のようなパイプラインで実現できます。
重複除去・ソートする場合
grep '/api/v1/' \
| awk 'match($0, /\/api\/v1\/([^\/]+)/, m) { print m[1] }' \
| sort -u
ファイルの末尾100行に限定したい場合は、先頭に tail -n 100 を追加
tail -n 100 your.log \
| grep '/api/v1/' \
| awk 'match($0, /\/api\/v1\/([^\/]+)/, m) { print m[1] }' \
| sort -u
PowerShell でやる場合
PowerShell は Linux のようなワンライナー処理には向きませんが、以下のようにすれば似たことができます:
Get-Content .\your.log |
Select-String '/api/v1/' |
ForEach-Object {
if ($_ -match '/api/v1/([^/]+)') {
$matches[1]
}
} | Sort-Object -Unique