mirror of
https://github.com/Findus23/nonsense.git
synced 2024-09-19 16:03:50 +02:00
23 lines
578 B
Bash
Executable file
23 lines
578 B
Bash
Executable file
#!/bin/bash
|
|
rm ikeaname.txt
|
|
rm descr.txt
|
|
|
|
for i in {0..25}
|
|
do
|
|
wget -O download.tmp http://www.ikea.com/gb/en/catalog/productsaz/$i/
|
|
grep "productsAzLink" download.tmp > lines.tmp
|
|
while read line; do
|
|
name=$(echo $line | xmllint --xpath 'string(//a)' -)
|
|
ikeaname=$(echo "$name" | egrep -o "((([A-Z])+){2,} *)+")
|
|
descr=${name#$ikeaname}
|
|
echo $ikeaname >> ikeaname.txt
|
|
echo $descr >> descr.txt
|
|
done <lines.tmp
|
|
done
|
|
rm *.tmp
|
|
|
|
sort ikeaname.txt | uniq > ikeaname.txt.tmp
|
|
sort descr.txt | uniq > descr.txt.tmp
|
|
mv ikeaname.txt.tmp ikeaname.txt
|
|
mv descr.txt.tmp descr.txt
|
|
|