Skip to content

Instantly share code, notes, and snippets.

View codejake's full-sized avatar

Jake Shaw codejake

View GitHub Profile
@codejake
codejake / gist:74208d678cbada093af21a6ac8f1b5da
Last active December 11, 2018 17:50
powershell-tokenizing fun
PS> cat .\pets.txt
dog,bowser,5
cat,mimi,4
snake,mr slithers,18
PS> get-content "pets.txt" | foreach-object {
$data = $_ -split ","
"{1} is a {0} who is {2} years old" -f $data[0],$data[1],$data[2]
}
@codejake
codejake / ps-sed.txt
Last active December 11, 2018 16:38
sed-like fun with PowerShell.
PS1> Get-Content foo.txt
dog
cat
bird
fish
chicken
duck
giraffe
PS1> Get-Content foo.txt | %{$_ -replace "duck", "fruit"}