torrent/nushell/examples/restcall_xml.nu
2024-01-13 13:01:54 +03:00

27 lines
1023 B
Plaintext

let l = http get https://blog.rust-lang.org/feed.xml
let data = $l.content | into value | where tag == 'author'
echo $data | to json
# now we get one list of the content
$data | get content | each { get content | each { get content } } | flatten | flatten | to json | save /tmp/test.json
let input = "182.178.55.3:4333"
$input | parse --regex '(?P<addr>\d{1,3}(\.\d{1,3}){3})(:(?P<port>\d+))?' | default port 2222 | select addr port
let input = "182.178.55.3"
$input | parse --regex '(?P<addr>\d{1,3}(\.\d{1,3}){3})(:(?P<port>\d+))?' | default port 2222 | select addr port
let input = "182.178.55.3:4333"
$input | parse --regex '(?P<addr>\d{1,3}(\.\d{1,3}){3})(:(?P<port>\d+))?' |
each { |row| if $row.port == $"" { $row | upsert port 2222 } else { $row } } | select addr port
let ipaddr_ = $input | parse --regex '(?P<addr>\d{1,3}(\.\d{1,3}){3})(:(?P<port>\d+))?' | select addr port
let ipaddr = $ipaddr_.port ???
$input | parse '{addr}:{port}'
let data = open data.json | from json
let x = "sss"