Skip to content
Snippets Groups Projects
Commit 75533b03 authored by Pedro Folloni Pesserl's avatar Pedro Folloni Pesserl
Browse files

tshell:p3: fix xgrep path

parent 9fd27276
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
XGREP=xgrep
command xgrep &> /dev/null || XGREP=/home/soft/xgrep/bin/xgrep
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
>&2 echo "Uso: ./tshell_p3.sh <axml> <acsv>" >&2 echo "Uso: ./tshell_p3.sh <axml> <acsv>"
exit 1 exit 1
...@@ -37,7 +40,7 @@ CSV=$(realpath $CSV) ...@@ -37,7 +40,7 @@ CSV=$(realpath $CSV)
# converter o arquivo xml.gz para o formato csv # converter o arquivo xml.gz para o formato csv
zcat $XML | \ zcat $XML | \
xgrep -tx "//PMID|//ArticleTitle|//Abstract|//MeshHeadingList" | \ $XGREP -tx "//PMID|//ArticleTitle|//Abstract|//MeshHeadingList" | \
# o sed acha os campos úteis -- PMID seguido de ArticleTitle seguido # o sed acha os campos úteis -- PMID seguido de ArticleTitle seguido
# de Abstract, seguido ou não de MeshHeadingList -- e converte no # de Abstract, seguido ou não de MeshHeadingList -- e converte no
# formato csv. No caso de não haver MeshHeadingList para um dado artigo, # formato csv. No caso de não haver MeshHeadingList para um dado artigo,
...@@ -80,4 +83,5 @@ sed -En ' ...@@ -80,4 +83,5 @@ sed -En '
}; };
bx; bx;
}' | \ }' | \
# remover as quebras de linhas necessárias
awk 'BEGIN {RS=""} {gsub(/<\n/, "<", $0); print $0}' >> $CSV awk 'BEGIN {RS=""} {gsub(/<\n/, "<", $0); print $0}' >> $CSV
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment