Ooops just noticed that sed command on the URL only removed the first double quote.
Small tweak required when I reread man sed
thats better note the ‘g’
willie@gagarin:~$ MY_SAFE_KEY_URL=$(awk '{if(NR==1) print $4}' keys.txt|sed 's/"//g')
willie@gagarin:~$ echo $MY_SAFE_KEY_URL
safe://hyryyyyyyk7xrd6yqzcpd8a69g1zxp85pdfzimiudfnkxyigcmi7hsa38seuy
2 Likes
Sascha
December 23, 2021, 7:47pm
22
sed 's/"//'
Southside:
Small tweak required
Could a ‘g’ be missing?
sed 's/"//g'
EDIT: Oops. I tried to be a smartass, but too late.
1 Like
yep see edited post above
1 Like
No - you were trying to help - thank you
1 Like
Sascha
December 23, 2021, 7:50pm
25
In all honesty, it was a bit of both.
1 Like
bochaco
December 23, 2021, 8:12pm
26
You could also use the --json
flag of CLI, with perhaps the jq tool , e.g.:
$ safe keys create --json | jq .[0]
"safe://hyryyyyyypgogf65ki5js49xqhzj9qkopxsuyoxjmxzw1m35xpk8fmyaz5xho"
$ safe keys create --json | jq .[1] > keypair.txt
$ safe keys create --json | jq .[1][0] > pk.txt
$ safe keys create --json | jq .[1][1] > sk.txt
2 Likes
chriso
December 23, 2021, 8:17pm
27
Yeah, jq
is great. I use it a lot, even just piping through and doing a jq .
to get a ‘pretty print’ is very handy.
I never remember how to use its querying language though.
1 Like
neo
December 24, 2021, 12:21am
28
grep -i “safekey *created” | sed “s~.*://~~; s~\”~~"
This will get you the key from the output (file) and saves using awk and jq. Just uses grep and sed and is fastest way
1 Like
At first glance this looks like an OK series of tutorials
VIDEO
Unlike many perfectly competent and grammatically correct presenters from the Indian sub-continent, this guy is actually quite intelligible.
Many tutorials are spoilt for me because I find it very difficult to get my ears around the Indian accent even though they are speaking quite correct English.
chriso
December 24, 2021, 10:58pm
30
Cheers! Although I’m a reader, so I always prefer a book for learning something like a programming language.
1 Like