Remove non-ASCII characters in a file [duplicate]

If you want to use Perl, do it like this: perl -pi -e ‘s/[^[:ascii:]]//g’ filename Detailed Explanation The following explanation covers every part of the above command assuming the reader is unfamiliar with anything in the solution… perl run the perl interpreter. Perl is a programming language that is typically available on all unix like … Read more

Named Pipes (FIFOs) on Unix with multiple readers

The O in FIFO means “out”. Once your data is “out”, it’s gone. 🙂 So naturally if another process comes along and someone else has already issued a read, the data isn’t going to be there twice. To accomplish what you suggest you should look into Unix domain sockets. Manpage here. You can write a … Read more

Unix sort of version numbers

The -V option is the nicest, but I wanted to stay away from installing new/other software since my sort didn’t have that option. This is the command that worked for me in the end: sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n test.txt From comments: To reverse the order: sort -t. -k 1,1nr … Read more

How do you recursively unzip archives in a directory and its subdirectories from the Unix command-line?

If you want to extract the files to the respective folder you can try this find . -name “*.zip” | while read filename; do unzip -o -d “`dirname “$filename”`” “$filename”; done; A multi-processed version for systems that can handle high I/O: find . -name “*.zip” | xargs -P 5 -I fileName sh -c ‘unzip -o … Read more