<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.11/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.11/ http://www.mediawiki.org/xml/export-0.11.xsd" version="0.11" xml:lang="en">
  <siteinfo>
    <sitename>Essential</sitename>
    <dbname>wikidb</dbname>
    <base>https://infocepo.com/wiki/index.php/Main_Page</base>
    <generator>MediaWiki 1.39.13</generator>
    <case>first-letter</case>
    <namespaces>
      <namespace key="-2" case="first-letter">Media</namespace>
      <namespace key="-1" case="first-letter">Special</namespace>
      <namespace key="0" case="first-letter" />
      <namespace key="1" case="first-letter">Talk</namespace>
      <namespace key="2" case="first-letter">User</namespace>
      <namespace key="3" case="first-letter">User talk</namespace>
      <namespace key="4" case="first-letter">Essential</namespace>
      <namespace key="5" case="first-letter">Essential talk</namespace>
      <namespace key="6" case="first-letter">File</namespace>
      <namespace key="7" case="first-letter">File talk</namespace>
      <namespace key="8" case="first-letter">MediaWiki</namespace>
      <namespace key="9" case="first-letter">MediaWiki talk</namespace>
      <namespace key="10" case="first-letter">Template</namespace>
      <namespace key="11" case="first-letter">Template talk</namespace>
      <namespace key="12" case="first-letter">Help</namespace>
      <namespace key="13" case="first-letter">Help talk</namespace>
      <namespace key="14" case="first-letter">Category</namespace>
      <namespace key="15" case="first-letter">Category talk</namespace>
    </namespaces>
  </siteinfo>
  <page>
    <title>ResultDiff</title>
    <ns>0</ns>
    <id>144</id>
    <revision>
      <id>1883</id>
      <parentid>1797</parentid>
      <timestamp>2025-05-20T10:06:24Z</timestamp>
      <contributor>
        <username>Tcepo</username>
        <id>2</id>
      </contributor>
      <comment>/* code */</comment>
      <origin>1883</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="4371" sha1="3y84tp6cudqcq4vcinlzfife3ux549n" xml:space="preserve">===AUTOMATED===
* Set variables :
&lt;pre&gt;
#export resultDiff=~/resultDiff
export filesList=""
&lt;/pre&gt;
* Execute :
&lt;syntaxhighlight lang="bash"&gt;
mkdir -p ~/old &amp;&amp;\
curl https://infocepo.com/wiki/index.php/Special:Export/ResultDiff 2&gt;/dev/null |tac |sed -r '0,/'"#"'24cc42#/d' |tac |sed -r '0,/'"#"'24cc42#/d' |sed 's/'"&amp;"'amp;/\&amp;/g;s/'"&amp;"'gt;/&gt;/g;s/'"&amp;"'lt;/&lt;/g' &gt;~/old/$$ &amp;&amp;\
bash ~/old/$$
&lt;/syntaxhighlight&gt;
====code====
&lt;syntaxhighlight lang="bash"&gt;
#24cc42#
#https://github.com/ynotopec/diff-multi

#[ $# -lt 1 ] &amp;&amp;exit

# initialisation des variables
baseDir="$(realpath "$(dirname $0)"/..)"
cacheFile=/tmp/"$(basename $0)"$$

########### commun algo
rm -rf /tmp/analyse*
#filesList="$(ls -1d $1/*)"
[ -z "${resultDiff}" ] &amp;&amp;resultDiff="${OLDPWD}"
[ -z "${filesList}" ] &amp;&amp;filesList="$(ls -1d .)"

# work dirs
mkdir -p /tmp/analyse$$/files /tmp/analyse$$/diff

# cp files and unzip
#echo "${filesList}" |while read fileName ;do
#  cp -p "${fileName}" /tmp/analyse$$/files/"$(echo "${fileName}" |tr '/' '-' )"
#done
count=1
echo "${filesList}" | while read fileName; do
  baseName="$(echo "${fileName}" | tr '/' '-')"
  cp -p "${fileName}" "/tmp/analyse$$/files/${count}-${baseName}"
  count=$((count + 1))
done

gunzip /tmp/analyse$$/files/*.gz 2&gt;/dev/null
filesList="$(ls -1d /tmp/analyse$$/files/*)"

## find words
# stat words
echo "${filesList}" |while read fileName ;do
  cat "${fileName}" \
    |tr -c "[:alnum:]_" "[\n*]" |grep -v "^\s*$" |sort -u
done \
  &gt;/tmp/analyse$$/statWords

triggerValue=$(($(ls -1d /tmp/analyse$$/files/* |wc -l) / 2))

# keep vars words
#awk 'NR == FNR {count[$0]++; next}; count[$0] &lt;= '"${triggerValue}" /tmp/analyse$$/statWords /tmp/analyse$$/statWords |sort -u &gt;/tmp/analyse$$/statWords.vars

# replace vars
cp -a /tmp/analyse$$/files /tmp/analyse$$/files.cache
cat /tmp/analyse$$/statWords.vars 2&gt;/dev/null |while read lineMy ;do sed -i "s#\b${lineMy}\b#\${varMy}#g" /tmp/analyse$$/files.cache/* ;done 2&gt;/dev/null

# comm = /tmp/analyse$$/comm
ls -1d /tmp/analyse$$/files.cache/* |while read fileName ;do
  cat "${fileName}" \
    |awk '!seen[$0]++'
done \
  &gt;/tmp/analyse$$/comm

awk 'NR == FNR {count[$0]++; next}; count[$0] &gt; '"${triggerValue}" /tmp/analyse$$/comm /tmp/analyse$$/comm \
  |awk '!seen[$0]++' &gt;/tmp/analyse$$/comm2
mv -f /tmp/analyse$$/comm2 /tmp/analyse$$/comm

# diff = /tmp/analyse$$/diff/
ls -1d /tmp/analyse$$/files.cache/* |while read fileName ;do
  ( echo "== $(basename "${fileName}") =="
    cat "${fileName}"
    echo "=== missing ==="
    cat /tmp/analyse$$/comm
  ) &gt;/tmp/analyse$$/tmp

  awk 'NR == FNR {count[$0]++; next}; count[$0] == 1' /tmp/analyse$$/tmp /tmp/analyse$$/tmp \
    |tee /tmp/analyse$$/diff/"$(basename "${fileName}")"
done

# libère cache
rm -f /tmp/"$(basename $0)"$$*
#24cc42#
&lt;/syntaxhighlight&gt;

===Summary from ChatGPT===
This is a shell script written in Bash. The script starts by setting the "resultDiff" variable to a specific file path. The script then performs the following actions:

#    Creates a directory called "old" in the home directory.
#    Changes the current working directory to the "old" directory.
#    Downloads a file from "https://infocepo.com/wiki/index.php/Special:Export/ResultDiff", filters the data, and saves it to a temporary file.
#    Runs the temporary file.
#    Returns to the previous working directory.

The second part of the code is a more complex shell script that performs multiple actions related to file analysis and comparison. The script does the following:

#    Cleans up previous temporary files.
#    Makes two directories, "analyse$$/files" and "analyse$$/diff".
#    Copies all files from the "resultDiff" directory to the "analyse$$/files" directory, and unzips any ".gz" files.
#    Generates a list of unique words from all the files in the "analyse$$/files" directory.
#    Triggers an action if the number of files is above a certain value.
#    Replaces the words in the list with a placeholder, "varMy".
#    Compares the contents of all files in the "analyse$$/files" directory and creates a new file, "analyse$$/comm", with all common lines.
#    Filters out the lines in "analyse$$/comm" that are not present in more than half of the files.
#    Generates a "diff" file for each file in the "analyse$$/files" directory, showing the contents of the file and the missing common lines.
#    Cleans up temporary files.</text>
      <sha1>3y84tp6cudqcq4vcinlzfife3ux549n</sha1>
    </revision>
  </page>
</mediawiki>
