Sablonvita:fra

A Wikiszótárból, a nyitott szótárból
Ugrás a navigációhoz Ugrás a kereséshez
#!/bin/bash
while true
do
if [ -z "$1" ]
	then
		random=$[ RANDOM % 110348 ]
		echo "$random"
		nouny=$(cat magya | awk "NR==$random" )
	else
		nouny=$1
fi

echo "$nouny" 
nounx=$(curl -s -A "Mozilla/5.0" "http://translate.google.com/translate_a/t?client=t&text=$nouny&hl=en&sl=hu&tl=en&ie=UTF-8&oe=UTF-8&multires=1&prev=btn&ssel=0&tsel=0&sc=1" )
echo "$nounx" 
echo $nounx > nountemp1

if [ -n "$(grep -e [0-9][0-9][0-9][0-9][0-9] nountemp1 | grep -v verb | grep -v adjective| grep  noun)" ]
 then
	sed -i "s/\[\[/\n/g"  nountemp1 
	sed -i "s/\([0-9][0-9][0-9][0-9][0-9]\+\]\)/\1\n/g"  nountemp1 

	grep "$nouny" nountemp1 | grep "[0-9][0-9][0-9][0-9][0-9]\+"  > nounlines 
	sed -i "s/^,//g"  nounlines
	sed -i "s/^\[//g"  nounlines
	sed -i 's/"\][^a-zöüóőúéáűí]*$/"\]/g'  nounlines  
	cat nounlines | wc -l > nounnumoflines
	cat nounlines
	cat nounnumoflines
	nounnumoflines=$(cat nounnumoflines)
		for nouni in `seq 1 $nounnumoflines`
		do
		nounl=$(cat nounlines | awk "NR==$nouni")
		echo "$nouni"
		echo "$nounl"
		echo "$nounl" |  cut -d\" -f2 > nouneng
		sed -i "s/ /_/g"  nouneng
		nouneng=$(cat nouneng)
		nounhun=$(echo "$nounl" |  cut -d[ -f2 | cut -d] -f1)
		echo "$nounhun"
		echo "$nounhun" > nounhun
		sed -i "s/,/\n/g"  nounhun
		sed -i 's/"//g'  nounhun
		sed -i 's/\(.\+\)/# [[\1]]/g'  nounhun
		echo "{{engfn}}" > nountemp2
		cat  nounhun >> nountemp2
		cat nountemp2
		 if [ -n "$(lynx -dump http://hu.wiktionary.org/wiki/Speci%C3%A1lis:Lapok_export%C3%A1l%C3%A1sa/$nouneng | grep page)" ]
		  then
		   echo "$nouny"
 		  else
		   nounr=$(cat nountemp2 | sed ':a;N;$!ba;s/\n/ /g')
		   echo "$nounr"
		   sudo python ./add_text.py -page:$nouneng -textfile:nountemp2 -summary:"$nounr"  -pt:0    -always
		fi
		done

   if [ -n "$(lynx -dump http://hu.wiktionary.org/wiki/Speci%C3%A1lis:Lapok_export%C3%A1l%C3%A1sa/$nouny | grep page)" ]
	then
	echo 'noback'
	else
	grep noun nountemp1 > nounback1
	sed -i s/\"//g nounback1
	sed -i s/noun//g nounback1
	sed -i "s/\[//g" nounback1
	sed -i "s/\]//g" nounback1
	sed -i "s/\([a-z]\),\([a-z]\)/\1}}, {{t\|en\|\2/g" nounback1
	sed -i 's/^,/\*\{\{en\}\}: \{\{t\|en\|/g' nounback1
	sed -i s/,$/\}\}/g nounback1
	echo {{hunfn}} > nountemp3
	echo {{-ford-}} >> nountemp3
	cat nounback1 >> nountemp3
		   nounp=$(cat nountemp3 | sed ':a;N;$!ba;s/\n/ /g')
	sudo python ./add_text.py -page:$nouny -textfile:nountemp3 -summary:"$nounp"  -pt:0 -always

   fi

 else
 echo "nincs ford"
fi

done