#!/bin/bash
#cd work
filename1="html"
filename2="txt"
d=$(date +%Y%m%d) # The "+%s" option to 'date' is GNU-specific.
html=$d.$filename1
txt=$d.$filename2
cp "$d.$filename1" "$d.x.$filename2"
# URL-ek kiemelése és textbe írása
lynx -dump $html | grep -i npicture | awk '{print $2}' > $txt
cd pic
# a txt-ben lévő URL-ek letöltése
n=1
for i in `cat ../$txt`; do
wget $i -O "$n.tif"
n=`expr $n + 1`
done
# A tif fájlok átkonvertálása gif formátumba
for i in *
do
tmp=`echo $i | sed s/'\.[^.]*$'//`
convert "$tmp.tif" "$tmp.gif"
done
# könyvtár létrehozása a gifeknek
cd ..
folder=$(date +%m%d)
if [ ! -d `date +%m%d` ]; then
mkdir `date +%m%d`
fi
mv pic/*.gif $folder
rm -f pic/*.tif
rm -f $txt
# HTML átalakítás
file=$d.x.$filename2
tmp="tmp.txt"
sed '1,38d' $file > $tmp
mv $tmp $file
sed '2d' $file > $tmp
mv $tmp $file
sed -e 's,,,g' $file > $tmp
mv $tmp $file
sed -e 's,
|
,,g' $file > $tmp
mv $tmp $file
sed -e 's,,,g' $file > $tmp
mv $tmp $file
sed -e 's,,,g' $file > $tmp
mv $tmp $file
sed -e 's,| OBSERVER Találati lista |
,,g' $file > $tmp
mv $tmp $file
sed -e 's,,,g' $file > $tmp
mv $tmp $file
sed -e 's,2005.július 29. | ,,g' $file > $tmp
mv $tmp $file
sed -e 's, nowrap="nowrap" width="8%", valign="top" width="35%",g' $file > $tmp
mv $tmp $file
sed -e 's, width="70%",,g' $file > $tmp
mv $tmp $file
sed -e 's,, | \ | ,g' $file > $tmp
mv $tmp $file
sed -e 's, | ,,g' $file > $tmp
mv $tmp $file
sed -e 's,
| ,
,g' $file > $tmp
mv $tmp $file
sed -e 's,OCR,,g' $file > $tmp
mv $tmp $file
sed -e 's,,,g' $file > $tmp
mv $tmp $file
sed -e 's,,\n,g' $file > $tmp
mv $tmp $file
sed -e 's,
,,g' $file > $tmp
mv $tmp $file
sed -e 's,
,
\n,g' $file > $tmp
mv $tmp $file
sed -e 's,,\n,g' $file > $tmp
mv $tmp $file
sed -e 's, ,,g' $file > $tmp
mv $tmp $file
cp $file $folder.$filename2
echo "Készen vagyunk :)"