⚲
Project
General
Profile
Sign in
Home
Projects
Help
Search
:
DCMTK
All Projects
DCMTK
Overview
Activity
Roadmap
Issues
News
Documents
Wiki
Files
Download (994 Bytes)
Bug #723
ยป rename_manpages.sh
Jan Schlamelcher, 2017-04-06 19:18
#!/bin/bash
if
[
-z
${
1
+x
}
]
;
then
echo
-e
"Error: Please provide a path!"
;
else
find
$1
-type
f
-iname
"*.man"
-exec
bash
-c
'
for file do
FILENAME=$(basename $file | sed s/\\.man//g);
echo -en "$file";
echo " ...changing values";
echo -n > ./temporary_file.tmp
echo "...write in temporary file";
while IFS='
"'"
''
"'"
' read -r line || [[ -n "$line" ]]; do
COMP=$(echo "$line" | grep -E "\\\\(sub)*section\\s" | grep -v $FILENAME);
if [ -n "$COMP" ];
then
echo -E "$line" | sed '
"'"
's/\(\\\(sub\)*section\s\)/\1'
"'"
'$FILENAME'
"'"
'_/g'
"'"
' >> ./temporary_file.tmp;
else
echo -E "$line" >> ./temporary_file.tmp
fi;
done < "$file";
echo "...finished";
echo "...override original file";
cp -f ./temporary_file.tmp $file;
echo -e "done\n";
done;
'
sh
{}
+
fi
;
(1-1/1)
Loading...