|Perl Monk, Perl Meditation|
a one-liner for this trivial problem?by Anonymous Monk
|on Apr 16, 2013 at 14:42 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
so, because I am no expert in Perl, I was wondering what is (since I am sure there is) an efficient one-liner script to do the following:
Ig you have a file with let's say IDS (1000 of them) and another one, smaller, with 20 or 30 of them, that belong to the big one. So, what you want to to do is to remove these 20 from the big file, so that in the end, the big file has 980 IDS instead of 1000.
My poor knowledge of Perl would create a proper script, where I would open the big file, store the IDS in an array or hash, then open the smaller one, and, for each of the IDS in the smaller file, if they existed in the array or hash that had been created based on the big file, I would erase them from there.
Any easy-to-use one-liner for this? I looked around for AWK and I found this:
Remove the line containing the string "awk": sed '/awk/d' filename.txt
but I don't know if this can be useful...