powershell - Remove path from output -


using following select-string command in powershell:

select-string -path e:\documents\combined0.txt -pattern "get /ccsetup\.exe" -allmatches > e:\documents\combined3.txt 

creates output file each line starting path , file name followed colon. example:

e:\documents\combined0.txt:255:255.255.255 - - [31/dec/2014:04:15:16 -0800] "get /ccsetup.exe http/1.1" 301 451 "-" "mozilla/5.0 (compatible; searchmetricsbot; http://www.xxxx.com/en/xxxx-bot/)" 

how rid of output file path name, output file name , colon in results?

select-string outputs object can pick off properties want. get-member command show these object members if pipe e.g.:

select-string -path e:\documents\combined0.txt -pattern "get /ccsetup\.exe" -allmatches  |      get-member 

one of properties line. try way:

select-string -path e:\documents\combined0.txt -pattern "get /ccsetup\.exe" -allmatches |      foreach {$_.line} > e:\documents\combined3.txt 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -