-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdo-all
More file actions
executable file
·38 lines (34 loc) · 1.29 KB
/
do-all
File metadata and controls
executable file
·38 lines (34 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#Article_Dir=/home/jsae/Outputs/independence/word-sources/articles
Article_Dir=/home/jsae/2018/outputs/organizations/2020-orgfinder/cache/good
#Output_Dir=/home/jsae/Outputs/independence/word-sources/uncommon
Output_Dir=/home/jsae/2018/outputs/organizations/2020-orgfinder/good/keywords
Script_Dir=/home/jsae/Outputs/git/stack-agents-prv
Script_Name=Uncommon.php
#FilesSet=*.txt
FilesSet=*.md
cd $Article_Dir
for f in $FilesSet
do
echo "Processing file $f:"
#echo $Article_Dir
#echo $Output_Dir
#echo $Script_Dir
#echo $Script_Name
# insert new article file name into PHP script
old="$Article_Dir"
new="$Article_Dir/$f"
phpScript="$Script_Dir/$Script_Name"
escOld=$(sed 's/[^^\\]/[&]/g; s/\^/\\^/g; s/\\/\\\\/g' <<< "$old")
escNew=$(sed 's/[&/\]/\\&/g' <<< "$new")
sed -i "/$escOld/c\\\$file = \"$escNew\";" "$phpScript"
cp -vf $phpScript /var/www/stackr.test/vendor/nrwtaylor/stack-agent-thing/agents/.
# run agent PHP
echo "Saving results to $Output_Dir/"$f".out"
php /var/www/stackr.test/agent uncommon > $Output_Dir/"$f".out
# remove error messages
sed -i -e "/Warning seen/d" -e "/Notice/d" -e "/APACHE/d" -e"s/Found uncommon words://" -e "s/ /\n/g" $Output_Dir/"$f".out
done
cd $Output_Dir
echo $PWD
rename "s/ //g" *.out