Advertisement
metalx1000

Ferguson Catalog Generator

Feb 23rd, 2022 (edited)
1,790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.69 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. wget -U "ferg" -mkEpnp "https://www.ferguson.com/category/"
  4.  
  5. find www.ferguson.com/category -type d -name "*plumb*"|\
  6.   while read folder;
  7.   do
  8.     find $folder -iname "*.html"|
  9.       while read f
  10.       do
  11.         cat "$f";done |\
  12.           tr -d "\n"|\
  13.           sed 's/</\n</g'|\
  14.           grep "data-productid"|\
  15.           cut -d\" -f2,4,8|\
  16.           tr -d "," >> products.lst
  17.         done
  18.         sort -u products.lst -o products.lst
  19.  
  20.         cat products.lst|\
  21.           cut -d\/ -f5,7|\
  22.           tr "/" '"'|\
  23.           tr "-" " "|\
  24.           cut -d\" -f1,3,4|\
  25.           fzf|\
  26.           tr '"' "\n"
  27.  
  28. echo -n "Number of Products Found: "
  29. wc -l products.lst
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement