Extract specific Z file method

I downloaded files from ftp:// via

wget -r -nc ftp://

distribution by years from 1998 to 2016 and per years contain 365 or 366 days

It contains these files (or similar) for each day

I want to extract only the files beginning with "codg"

1 Answer

Create a simple script which will extract files from the current directory.

cat > /tmp/extract.sh <<'EOF'
#!/bin/bash
for x in "$@"; do uncompress -f "${x}" rm -f "${x}"
done
EOF
chmod 755 /tmp/extract.sh

Then use a find command to iterate through the directories to do the operation of that script on every file.

find . -type f -name 'codg*.Z' -execdir /tmp/extract.sh {} +

The find command should be executed from the directory of your downloaded files. See find(1) man page and understand the options before executing.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like