All pastes #1693115 Raw Edit

Something

public text v1 · immutable
#1693115 ·published 2009-11-29 22:18 UTC
rendered paste body
#!/bin/sh

# Usage: rn-defuckifier path-to-masterlist

# I suggest you run this from an empty directory, to avoid
# clobbering existing files.

# Known good rn words in one file ... all other n words in another
# (known good = words that contain "rn" without a preceding "n")

awk '!/n/ {next}
     /^[^n]*rn/ {
        sub(/rn/, "n");
        print | "sort | uniq > rn-rstripped-file"
        next
     }
     {print | "sort | uniq > n-file"}' "$1"


# Words unique to n-file have no rn counterpart
comm -2 -3 n-file rn-rstripped-file > n-file-corrupted

# Eliminate words from the master list which appear in the corrupted list
grep -vxFf n-file-corrupted "$1" > defuckified