I have two reasonably-sized lists of (real-example) Stack Overflow answer IDs that I'm checking for suspected ChatGPT usage. One set is a list of answer IDs I captured a few days ago, and the other is the current set. I'd like to compare the two and find the answers that have been removed (deleted answers) in the second set. How can I do this using Nushell?
My IDs (not real examples):
let idsFromYesterday = [ 42 83 111 212 411 812 7000 31459 ]
let idsFromToday = [ 42 83 212 411 7000 111 ]
Use a filter
with the not
and in
operators:
let idsFromYesterday = [ 42 83 111 212 411 812 7000 31459 ]
let idsFromToday = [ 42 83 212 411 7000 111 ]
$idsFromYesterday | filter {|id| not ($id in $idsFromToday) }
Will return the missing IDs:
╭───┬───────╮
│ 0 │ 812 │
│ 1 │ 31459 │
╰───┴───────╯