Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
prog-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pedro Folloni Pesserl
prog-1
Commits
9fff7b78
Commit
9fff7b78
authored
2 years ago
by
Pedro Folloni Pesserl
Browse files
Options
Downloads
Patches
Plain Diff
tshell: fix grep in part 1; error functions in part 3
parent
e43ede9f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tshell/tshell_p1.sh
+3
-3
3 additions, 3 deletions
tshell/tshell_p1.sh
tshell/tshell_p2.sh
+2
-2
2 additions, 2 deletions
tshell/tshell_p2.sh
tshell/tshell_p3.sh
+37
-0
37 additions, 0 deletions
tshell/tshell_p3.sh
with
42 additions
and
5 deletions
tshell/tshell_p1.sh
+
3
−
3
View file @
9fff7b78
#!/bin/bash
if
[
$#
-lt
3
]
||
[
$#
-gt
5
]
;
then
>
&2
echo
"Uso: <dpm> <ds> <t1> [<t2> [<t3>]]"
>
&2
echo
"Uso:
./tshell_p1.sh
<dpm> <ds> <t1> [<t2> [<t3>]]"
exit
1
fi
...
...
@@ -13,7 +13,7 @@ T3=$5
if
[
!
-d
$FONTE
]
;
then
>
&2
echo
"Erro:
$FONTE
não é um diretório."
exit
1
exit
2
fi
FONTE
=
$(
realpath
$FONTE
)
...
...
@@ -26,6 +26,6 @@ DESTINO=$(realpath $DESTINO)
cd
$FONTE
for
ARQ
in
*
.csv
;
do
awk
'(NR>1)'
$ARQ
|
grep
-iF
"
$T1
"
|
grep
-iF
"
$T2
"
|
grep
-iF
"
$T3
"
>
$DESTINO
/
$ARQ
awk
'(NR>1)'
$ARQ
|
grep
-i
w
F
"
$T1
"
|
grep
-i
w
F
"
$T2
"
|
grep
-i
w
F
"
$T3
"
>
$DESTINO
/
$ARQ
done
cd
-
>
/dev/null
This diff is collapsed.
Click to expand it.
tshell/tshell_p2.sh
+
2
−
2
View file @
9fff7b78
#!/bin/bash
if
[
$#
-ne
2
]
;
then
>
&2
echo
"Uso: <dcsv> <dsin>"
>
&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
1
exit
2
fi
}
...
...
This diff is collapsed.
Click to expand it.
tshell/tshell_p3.sh
+
37
−
0
View file @
9fff7b78
#!/bin/bash
if
[
$#
-ne
2
]
;
then
>
&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
}
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
}
XML
=
$1
confere_arq_entrada
$XML
XML
=
$(
realpath
$XML
)
CSV
=
$2
confere_arq_saida
$CSV
CSV
=
$(
realpath
$CSV
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment