Skip to main content
added 220 characters in body
Source Link
eny
  • 13
  • 6

I have downloaded about 3200 websites to the depth 2. So now I have one master folder (abc) that contains many folders, containing files for each website. So my folder abc contains 3200 folders and each folder contains other folders that contains files with text from the websites. I have also a script that can edit text in each file. It is stored in file named lynx.sh:

#!/bin/bash
fileA=$1
while IFS= read -r lineA
do
LTRA=$(echo "${lineA:0:1}")
catA=$(lynx -dump -nonumbers -nomargins -nolist -noprint -width 1000 -assume_charset=utf-8 $2/*.* )
editA=$(echo "$catA" | sed -e 's/\[[^][]*\]//g')
editB=$(echo "$editA" | sed -e 's/\s\+/\n/g')
editC=$(echo "$editB" | sed '/^http/ d' )
editD=$(echo "$editC" | sed '/^IFRAME/ d' )
editE=$(echo "$editD" | sed 's/<[^>]*>//g' )
editF=$(echo "$editE" | sed -r 's/[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ][^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]+//g' )
editG=$(echo "$editF" | sed s'/[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]$//')
editH=$(echo "$editG" | sed s'/^[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]//')
editI=$(echo "$editH" | sed 's/ .*//')
editJ=$(echo "$editI" | sed '/^$/d' )
echo "$editJ" > $2/"blaaa"_lynx.txt
echo "$lineA"
done <"$fileA"

It makes text in each file to be edited - every word is on the new line. I have used this script many times before but I use it with file input.txt which contains names of all websites that i have.

Now I am trying to edit all folders in my abc folder at once. I have tried to use somtehing like this:

find /home/student/eny/abc -exec lynx.sh {} \;
find /home/student/eny/abc/* -iname -exec ./lynx.sh input.txt {} \;

and many others. I can not find a solution for this.

In input.txt there are names of sites for example: kosice.sk bratislava.sk presov.sk every name of the site is on a new line and they are in aplhabet order. And they are also as names of dir of the first level.

I have downloaded about 3200 websites to the depth 2. So now I have one master folder (abc) that contains many folders, containing files for each website. So my folder abc contains 3200 folders and each folder contains other folders that contains files with text from the websites. I have also a script that can edit text in each file. It is stored in file named lynx.sh:

#!/bin/bash
fileA=$1
while IFS= read -r lineA
do
LTRA=$(echo "${lineA:0:1}")
catA=$(lynx -dump -nonumbers -nomargins -nolist -noprint -width 1000 -assume_charset=utf-8 $2/*.* )
editA=$(echo "$catA" | sed -e 's/\[[^][]*\]//g')
editB=$(echo "$editA" | sed -e 's/\s\+/\n/g')
editC=$(echo "$editB" | sed '/^http/ d' )
editD=$(echo "$editC" | sed '/^IFRAME/ d' )
editE=$(echo "$editD" | sed 's/<[^>]*>//g' )
editF=$(echo "$editE" | sed -r 's/[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ][^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]+//g' )
editG=$(echo "$editF" | sed s'/[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]$//')
editH=$(echo "$editG" | sed s'/^[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]//')
editI=$(echo "$editH" | sed 's/ .*//')
editJ=$(echo "$editI" | sed '/^$/d' )
echo "$editJ" > $2/"blaaa"_lynx.txt
echo "$lineA"
done <"$fileA"

It makes text in each file to be edited - every word is on the new line. I have used this script many times before but I use it with file input.txt which contains names of all websites that i have.

Now I am trying to edit all folders in my abc folder at once. I have tried to use somtehing like this:

find /home/student/eny/abc -exec lynx.sh {} \;
find /home/student/eny/abc/* -iname -exec ./lynx.sh input.txt {} \;

and many others. I can not find a solution for this.

I have downloaded about 3200 websites to the depth 2. So now I have one master folder (abc) that contains many folders, containing files for each website. So my folder abc contains 3200 folders and each folder contains other folders that contains files with text from the websites. I have also a script that can edit text in each file. It is stored in file named lynx.sh:

#!/bin/bash
fileA=$1
while IFS= read -r lineA
do
LTRA=$(echo "${lineA:0:1}")
catA=$(lynx -dump -nonumbers -nomargins -nolist -noprint -width 1000 -assume_charset=utf-8 $2/*.* )
editA=$(echo "$catA" | sed -e 's/\[[^][]*\]//g')
editB=$(echo "$editA" | sed -e 's/\s\+/\n/g')
editC=$(echo "$editB" | sed '/^http/ d' )
editD=$(echo "$editC" | sed '/^IFRAME/ d' )
editE=$(echo "$editD" | sed 's/<[^>]*>//g' )
editF=$(echo "$editE" | sed -r 's/[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ][^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]+//g' )
editG=$(echo "$editF" | sed s'/[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]$//')
editH=$(echo "$editG" | sed s'/^[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]//')
editI=$(echo "$editH" | sed 's/ .*//')
editJ=$(echo "$editI" | sed '/^$/d' )
echo "$editJ" > $2/"blaaa"_lynx.txt
echo "$lineA"
done <"$fileA"

It makes text in each file to be edited - every word is on the new line. I have used this script many times before but I use it with file input.txt which contains names of all websites that i have.

Now I am trying to edit all folders in my abc folder at once. I have tried to use somtehing like this:

find /home/student/eny/abc -exec lynx.sh {} \;
find /home/student/eny/abc/* -iname -exec ./lynx.sh input.txt {} \;

and many others. I can not find a solution for this.

In input.txt there are names of sites for example: kosice.sk bratislava.sk presov.sk every name of the site is on a new line and they are in aplhabet order. And they are also as names of dir of the first level.

Source Link
eny
  • 13
  • 6

How to find files and act on them (find + exec)

I have downloaded about 3200 websites to the depth 2. So now I have one master folder (abc) that contains many folders, containing files for each website. So my folder abc contains 3200 folders and each folder contains other folders that contains files with text from the websites. I have also a script that can edit text in each file. It is stored in file named lynx.sh:

#!/bin/bash
fileA=$1
while IFS= read -r lineA
do
LTRA=$(echo "${lineA:0:1}")
catA=$(lynx -dump -nonumbers -nomargins -nolist -noprint -width 1000 -assume_charset=utf-8 $2/*.* )
editA=$(echo "$catA" | sed -e 's/\[[^][]*\]//g')
editB=$(echo "$editA" | sed -e 's/\s\+/\n/g')
editC=$(echo "$editB" | sed '/^http/ d' )
editD=$(echo "$editC" | sed '/^IFRAME/ d' )
editE=$(echo "$editD" | sed 's/<[^>]*>//g' )
editF=$(echo "$editE" | sed -r 's/[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ][^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]+//g' )
editG=$(echo "$editF" | sed s'/[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]$//')
editH=$(echo "$editG" | sed s'/^[^aáäbcčdďdzdžeéfghchiíjklĺľmnňoópqrŕsštťuúvwxyýzžAÁÄBCČDĎDZDŽEÉFGHCHIÍJKLĹĽMNŇOÓPQRŔSŠTŤUÚVWXYÝZŽ]//')
editI=$(echo "$editH" | sed 's/ .*//')
editJ=$(echo "$editI" | sed '/^$/d' )
echo "$editJ" > $2/"blaaa"_lynx.txt
echo "$lineA"
done <"$fileA"

It makes text in each file to be edited - every word is on the new line. I have used this script many times before but I use it with file input.txt which contains names of all websites that i have.

Now I am trying to edit all folders in my abc folder at once. I have tried to use somtehing like this:

find /home/student/eny/abc -exec lynx.sh {} \;
find /home/student/eny/abc/* -iname -exec ./lynx.sh input.txt {} \;

and many others. I can not find a solution for this.