From ead6c99833849135e3067bd96fa78cfcdd89b38f Mon Sep 17 00:00:00 2001
From: Pedro Folloni Pesserl <fpesserl7@gmail.com>
Date: Mon, 27 Feb 2023 17:36:47 -0300
Subject: [PATCH] replace tabs with spaces and remove binary files

---
 tshell/tshell_p1.sh | 12 +++---
 tshell/tshell_p2.sh | 16 ++++----
 tshell/tshell_p3.sh | 96 ++++++++++++++++++++++-----------------------
 3 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/tshell/tshell_p1.sh b/tshell/tshell_p1.sh
index df94547..20bae0f 100755
--- a/tshell/tshell_p1.sh
+++ b/tshell/tshell_p1.sh
@@ -1,8 +1,8 @@
 #!/bin/bash
 
 if [ $# -lt 3 ] || [ $# -gt 5 ]; then
-	>&2 echo "Uso: ./tshell_p1.sh <dpm> <ds> <t1> [<t2> [<t3>]]"
-	exit 1
+    >&2 echo "Uso: ./tshell_p1.sh <dpm> <ds> <t1> [<t2> [<t3>]]"
+    exit 1
 fi
 
 FONTE=$1
@@ -12,20 +12,20 @@ T2=$4
 T3=$5
 
 if [ ! -d $FONTE ]; then
-	>&2 echo "Erro: $FONTE não é um diretório."
-	exit 2
+    >&2 echo "Erro: $FONTE não é um diretório."
+    exit 2
 fi
 
 FONTE=$(realpath $FONTE)
 
 if [ ! -d $DESTINO ]; then
-	mkdir $DESTINO
+    mkdir $DESTINO
 fi
 
 DESTINO=$(realpath $DESTINO)
 
 cd $FONTE
 for ARQ in *.csv; do
-	awk '(NR>1)' $ARQ | grep -iwF "$T1" | grep -iwF "$T2" | grep -iwF "$T3" > $DESTINO/$ARQ
+    awk '(NR>1)' $ARQ | grep -iwF "$T1" | grep -iwF "$T2" | grep -iwF "$T3" > $DESTINO/$ARQ
 done
 cd - > /dev/null
diff --git a/tshell/tshell_p2.sh b/tshell/tshell_p2.sh
index 01b878b..3ec50fd 100755
--- a/tshell/tshell_p2.sh
+++ b/tshell/tshell_p2.sh
@@ -1,15 +1,15 @@
 #!/bin/bash
 
 if [ $# -ne 2 ]; then
-	>&2 echo "Uso: ./tshell_p2.sh <dcsv> <dsin>"
-	exit 1
+    >&2 echo "Uso: ./tshell_p2.sh <dcsv> <dsin>"
+    exit 1
 fi
 
 testa_diretorio() {
-	if [ ! -d $1 ]; then
-		>&2 echo "Erro: $1 não é um diretório."
-		exit 2
-	fi
+    if [ ! -d $1 ]; then
+        >&2 echo "Erro: $1 não é um diretório."
+        exit 2
+    fi
 }
 
 DCSV=$1
@@ -23,7 +23,7 @@ DSIN=$(realpath $DSIN)
 
 cd $DSIN
 for FATOR in *; do
-	CONT=$(grep -iwF -f $FATOR $DCSV/*.csv | wc -l)
-	echo "${FATOR%.*}:$CONT"
+    CONT=$(grep -iwF -f $FATOR $DCSV/*.csv | wc -l)
+    echo "${FATOR%.*}:$CONT"
 done
 cd - > /dev/null
diff --git a/tshell/tshell_p3.sh b/tshell/tshell_p3.sh
index e30664b..23f4835 100755
--- a/tshell/tshell_p3.sh
+++ b/tshell/tshell_p3.sh
@@ -4,30 +4,30 @@ XGREP=xgrep
 command xgrep &> /dev/null || XGREP=/home/soft/xgrep/bin/xgrep
 
 if [ $# -ne 2 ]; then
-	>&2 echo "Uso: ./tshell_p3.sh <axml> <acsv>"
-	exit 1
+    >&2 echo "Uso: ./tshell_p3.sh <axml> <acsv>"
+    exit 1
 fi
 
 confere_arq_entrada() {
-	IFS=. read -r NOME EXT <<< $1
-	if [ $EXT != "xml.gz" ]; then
-		>&2 echo "Erro: formato incorreto para $1 (deve ser .xml.gz)"
-		exit 2
-	fi
-	if [ ! -f $1 ]; then
-		>&2 echo "Erro: $1 não existe"
-		exit 3
-	fi
+    IFS=. read -r NOME EXT <<< $1
+    if [ $EXT != "xml.gz" ]; then
+        >&2 echo "Erro: formato incorreto para $1 (deve ser .xml.gz)"
+        exit 2
+    fi
+    if [ ! -f $1 ]; then
+        >&2 echo "Erro: $1 não existe"
+        exit 3
+    fi
 }
 
 confere_arq_saida() {
-	IFS=. read -r NOME EXT <<< $1
-	if [ $EXT != "csv" ]; then
-		>&2 echo "Erro: formato incorreto para $1 (deve ser .csv)"
-		exit 2
-	fi
-	
-	echo "version+pmid<title<abstract<keywords" > $1
+    IFS=. read -r NOME EXT <<< $1
+    if [ $EXT != "csv" ]; then
+        >&2 echo "Erro: formato incorreto para $1 (deve ser .csv)"
+        exit 2
+    fi
+    
+    echo "version+pmid<title<abstract<keywords" > $1
 }
 
 XML=$1
@@ -47,41 +47,41 @@ $XGREP -tx "//PMID|//ArticleTitle|//Abstract|//MeshHeadingList" | \
 # insere uma linha vazia.
 sed -En '
 :x; /<PMID/{
-	s/<PMID Version="//;
-	s/">//;
-	s/<\/PMID>/</;
-	x;
-	n;
+    s/<PMID Version="//;
+    s/">//;
+    s/<\/PMID>/</;
+    x;
+    n;
 
-	/<ArticleTitle>/{
-		s/<ArticleTitle>//;
-		s/ *<\/ArticleTitle>/</;
-		H;
-		n;
+    /<ArticleTitle>/{
+        s/<ArticleTitle>//;
+        s/ *<\/ArticleTitle>/</;
+        H;
+        n;
 
-		/<Abstract>/{
-			s/(<Abstract>|<AbstractText[^>]*>) *//g;
-			s/ *<\/AbstractText> *(|<CopyrightInformation>)/, /g;
-			s/(,|<\/CopyrightInformation>) *<\/Abstract>/</g;
-			H;
-			x;
-			p;
-			n;
+        /<Abstract>/{
+            s/(<Abstract>|<AbstractText[^>]*>) *//g;
+            s/ *<\/AbstractText> *(|<CopyrightInformation>)/, /g;
+            s/(,|<\/CopyrightInformation>) *<\/Abstract>/</g;
+            H;
+            x;
+            p;
+            n;
 
-			/<MeshHeadingList>/{
-				s/(<\/DescriptorName>|<\/QualifierName>) *(<Qualifier[^>]*>|<\/MeshHeading> *)/, /g;
-				s/(<MeshHeadingList> *|<MeshHeading> *<Descriptor[^>]*>|(, *|)<\/MeshHeadingList>)//g;
-				p;
-				d;
-			};
+            /<MeshHeadingList>/{
+                s/(<\/DescriptorName>|<\/QualifierName>) *(<Qualifier[^>]*>|<\/MeshHeading> *)/, /g;
+                s/(<MeshHeadingList> *|<MeshHeading> *<Descriptor[^>]*>|(, *|)<\/MeshHeadingList>)//g;
+                p;
+                d;
+            };
 
-			i \
+            i \
 
-			bx;
-		};
-		bx;
-	};
-	bx;
+            bx;
+        };
+        bx;
+    };
+    bx;
 }' | \
 # remover as quebras de linhas necessárias
 awk 'BEGIN {RS=""} {gsub(/<\n/, "<", $0); print $0}' >> $CSV
-- 
GitLab