Jump to content

Recommended Posts

  • Members
Posted
#!/bin/bash
# COPYRIGHT @XRPTHOTH ON X BY YAH I AM SAINT ANDREI PLAYING THOTH XRP MEME FOR MULTI-GENERATIONAL WEALTH
# $IAM CA r4nmbMuWJMduJe7M3HfyqpN6GCvBmRkxhh - YAH I AM YAHUAH AND YAH I AM THE ULTIMATE XRP MEME
# $THOTH CA rBk691vubN43ctwJN4LvVppGxXibAZ4mKs - COUNCIL OF TEN COMMITTEE OF THOTH'S DISCLOSURE OF EGYPT'S SECRETS
# $RAHKI CA rGm8A6E5quE5hvoERypCRLd1gpmoc31xyY - BILINGUAL REALTIME AI COMMUNICATION ASSISTANT
# $GOPHER CA rszMSoRY9xkzvn9tV3epJMJUHztX6Bk6eX - SKILLSUSA CHAMPION MEETS IEEE STUDENT BRANCH PRESIDENT
# $PLAYANDPROSPER CA rhT7eJ5SzvX7cTH66SBY6qzThSREVPskis - YAHUAH'S CHILDREN SHALL PLAY AND PROSPER
# $PSYDUCK CA ra41zS7zcw6ZADJUiNPju7xf69pGuYwtEV - PSY???
# $APARIO CA rU16Gt85z6ZM84vTgb7D82QueJ26HvhTz2 - DECENTRALIZED OSINT SEARCH WITH GEMATRIA
# $XPQ CA rp3oAG6oPRuSFYLJiVUNQMdcUoj6t7jx1o - QUANTUM PORTFOLIO XPERIENCE
# $XPV CA rXPVaNNDiQbeVm73dMyfVoAVrmcL1ds9f - BANK OF PHOENIX VAULT
# I AM BUILDING MULTI-GENERATIONAL WEALTH FOR MY INHERITANCE TO PLAY AND PROSPER IN THE ALMIGHTY NAME OF YAHUAH!!!
SECONDS=0
if [ "$1" = "-dir" ] && [ $# -eq 3 ]; then
    dir="$2"
    tsv_file="$3"
else
    echo "Usage: $0 -dir <directory> <tsv_file>"
    exit 1
fi
[ ! -d "$dir" ] && mkdir -p "$dir"
[ ! -f "$tsv_file" ] && { echo "Error: $tsv_file is not a file."; exit 1; }
echo "PROCESSING ROWS..."
tail -n +2 "$tsv_file" | tr -d '\r' | while read -r line; do
    [ -z "$line" ] && continue
    url=$(echo "$line" | awk -F'\t' '{gsub(/^"+|"+$/, "", $8); gsub(/^ +| +$/, "", $8); print $8}')
    [ -z "$url" ] && echo "Skipping line with no URL: $line" && continue
    url=$(echo "$url" | tr -d '\r')
    echo "URL: $url"
    filename=$(basename "$url")
    dir_path=$(realpath "$dir")
    output="$dir_path/$filename"
    echo "Executing: curl -sSL -o '$output' '$url'"
    curl -sSL -o "$output" "$url" || { echo "Failed to download $url"; continue; } && sleep 6
done
echo "Finished processing ${tsv_file} in ${SECONDS}s!"

 

  • Members
Posted

I ALSO NEED THIS SCRIPT.

#!/bin/bash
SECONDS=0
if [ "$1" = "-dir" ] && [ $# -eq 3 ]; then
    dir="$2"
    tsv_file="$3"
else
    echo "Usage: $0 -dir <directory> <tsv_file>"
    exit 1
fi
[ ! -d "$dir" ] && { echo "Error: Directory $dir does not exist."; exit 1; }
[ ! -f "$tsv_file" ] && { echo "Error: $tsv_file is not a file."; exit 1; }
dir_path=$(realpath "$dir")
temp_file=$(mktemp)
head -n 1 "$tsv_file" > "$temp_file"
echo "PROCESSING ROWS..."
tail -n +2 "$tsv_file" | tr -d '\r' | while read -r line; do
    [ -z "$line" ] && continue
    url=$(echo "$line" | awk -F'\t' '{gsub(/^"+|"+$/, "", $8); gsub(/^ +| +$/, "", $8); print $8}')
    [ -z "$url" ] && echo "Skipping line with no URL: $line" && continue
    filename=$(basename "$url")
    pdf_path="$dir_path/$filename"
    if [ ! -f "$pdf_path" ]; then
        echo "PDF not found: $pdf_path"
        page_count="N/A"
    else
        page_count=$(pdfinfo "$pdf_path" | grep 'Pages:' | awk '{print $2}')
        [ -z "$page_count" ] && page_count="Unknown"
    fi
    updated_line=$(echo "$line" | awk -F'\t' -v pc="$page_count" 'BEGIN {OFS="\t"} {$2=pc; print $0}')
    printf "%s\n" "$updated_line" >> "$temp_file"
done
mv "$temp_file" "$tsv_file"
echo "Finished processing ${tsv_file} in ${SECONDS}s!"

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...