pretty

Saturday, January 14, 2023

Grep in utf16 file

A quick way to grep in utf16 by converting it to utf-8 on the fly
iconv -f utf-16 -t utf-8 file.txt | grep query

Tuesday, January 10, 2023

recursive grep in Powershell

The eqvivalent of grep -r in Powershell
Get-ChildItem -Recurse -Include *.txt -Path . | Select-String -Pattern "foobar"

grep on a remote machine and save output to local machine

Grep on a remote machine and save output to local machine This particular example grep is used for trying to find deleted files on an disk in linux
ssh user@remotehost "grep -a  -P 'searchterm' /dev/md2" > output.txt