Skip to content

Instantly share code, notes, and snippets.

@defilerc
Created May 11, 2018 12:44
Show Gist options
  • Save defilerc/90078e3ac5c5d2337e86a6d6d9ce1f1d to your computer and use it in GitHub Desktop.
Save defilerc/90078e3ac5c5d2337e86a6d6d9ce1f1d to your computer and use it in GitHub Desktop.
# write to console
write-host "ok"
# use pipe to write to console
(1, 2, 3, 4, 5, 6) | % { write-host $_ }
# filter elements and write to console
(1, 2, 3, 4, 5, 6) | sort-object -descending | % { write-host $_ }
# get json from http
$list = wget https://raw.githubusercontent.com/PeterNotenboom/SwiftCodes/master/AllCountries/GB.json | convertfrom-json
write-host $list.list.count
# filter by .bank property (all starting with T)
(wget https://raw.githubusercontent.com/PeterNotenboom/SwiftCodes/master/AllCountries/GB.json | convertfrom-json).list |
? { return $_.bank -like "T*" } |
% { return “$($_.swift_code);$($_.bank)” } |
out-file c:\users\kathanasoglou\desktop\file.csv -encoding utf8
# create new .net object
$dt = New-Object system.data.datatable
# import csv delimited by ; and prin name property (read from header)
import-csv C:\Users\kathanasoglou\Desktop\kostas.txt -Delimiter ";" | % {
write-host $_.name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment