Hacker News new | past | comments | ask | show | jobs | submit login

    dedupe.awk <file >file.tmp && mv file.tmp file
Multifile versions vary, I'd prefer listing them out, alternatively you could read from a command output (ls, find, etc.) with a 'while read; do ... done' loop:

    for f in file1 file2 file3
    do
        dedupe.awk <$f > ${f}.tmp && mv ${f}.tmp $f
    done
If you want to apply to specific files on an ad hoc basis, you could wrap the whole thing in a shell function with filename or list as a parameter.

Or 'gawk -i' as suggested.

Properly using tempfile would also be an improvement.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: