Using curl & sed a utility command in Linux CLI (command line interface), we can grab all the word and save it into the txt files.
Here are the code :
#/bin/sh
for w in {A..Z};
do
curl http://ms.wiktionary.org/wiki/Wiktionary:Senarai_perkataan_$w | sed '/<li>/,/<\/li>/!d' | sed -e 's/<[^>]*>//g' | sed '/^$/d' | sed 's/, /\n/g' | sed '/\[sunting/d' | sed '/<!--/,/<\-->/d' > $w.txt;
echo "Counting Lines..";
wc -l $w.txt;
echo "Appending File $w to ALL.txt";
cat $w.txt >> ALL.txt;
done
Open up your text editor nano, vim or whatever text editor you like. Paste the code and save it.
Not to forget, make the file executable using "chmod +x yourfilename.sh"
That's it!
Here are the code :
#/bin/sh
for w in {A..Z};
do
curl http://ms.wiktionary.org/wiki/Wiktionary:Senarai_perkataan_$w | sed '/<li>/,/<\/li>/!d' | sed -e 's/<[^>]*>//g' | sed '/^$/d' | sed 's/, /\n/g' | sed '/\[sunting/d' | sed '/<!--/,/<\-->/d' > $w.txt;
echo "Counting Lines..";
wc -l $w.txt;
echo "Appending File $w to ALL.txt";
cat $w.txt >> ALL.txt;
done
Open up your text editor nano, vim or whatever text editor you like. Paste the code and save it.
Not to forget, make the file executable using "chmod +x yourfilename.sh"
That's it!
Comments
Post a Comment