Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Processando textos enormes com ferramentas "Unix"
Search
Luiz Menezes
February 11, 2017
73
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Processando textos enormes com ferramentas "Unix"
Palestra dada no evento "Linux em Prosa" do sancaLUG.
Luiz Menezes
February 11, 2017
More Decks by Luiz Menezes
See All by Luiz Menezes
async é bom, async eu gosto
luizmenezes
0
61
Testando aplicações web com py.test e selenium
luizmenezes
0
160
Python 3 Orientado a Objetos
luizmenezes
3
340
Expondo o Raspberry Pi via servidor web
luizmenezes
0
100
Workshop Django
luizmenezes
2
270
Bottle Admin
luizmenezes
0
110
IoT, Raspberry Pi e Python
luizmenezes
1
92
Coding Dojo
luizmenezes
0
75
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
Making the Leap to Tech Lead
cromwellryan
135
10k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Rails Girls Zürich Keynote
gr2m
96
14k
A better future with KSS
kneath
240
18k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
The Limits of Empathy - UXLibs8
cassininazir
1
640
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
Transcript
processando textos enormes com ferramentas "unix"
oi! eu sou o luiz me encontre em @luiz_amf github.com/lamenezes
abrir/ler e processar textões arquivos de texto com mais de
8 mil 10 milhões de linhas (>4 GB) o problema
None
“ Write programs that do one thing and do it
well Write programs to work together. Write programs to handle text streams, because that is a universal interface. "Unix Philosophy" por Peter Salus
fazer uma coisa e fazer bem a caixa de ferramentas
cat concatenate files and print ▷ visualizar arquivos texto ▷
exemplo $ cat foo.txt
less ▷ visualizar arquivos texto ▷ permite navegação ▷ lê
arquivo enquanto executa ▷ exemplo $ less foo.txt
cp copy ▷ sempre tenha um backup de seus dados
▷ exemplo $ cp foo.txt backup.txt
head & tail ▷ imprime X linhas do arquivo ▷
dividir e conquistar ▷ exemplos $ head foo.txt -n 20 $ tail foo.txt -n 50
▷ qual o tamanho da bronca? ▷ calcula do arquivo
◦ linhas ◦ caracteres/bytes ◦ palavras ▷ exemplo $ wc foo.txt wc word count
▷ remove partes de cada linha de um arquivo ▷
exemplo $ cut -f2,3-5 foo.txt cut
▷ editor "completo" ◦ substituição/remoção de caracteres ◦ duplica linhas
◦ remoção de linhas ◦ busca ▷ exemplo $ sed 's/foo/bar/' foo.txt sed stream editor
▷ busca ▷ exemplo $ grep agulha palheiro.txt grep global
search a regular expression and print
trabalhar bem em conjunto a interface universal de stream de
textos
pipes ▷ encadeamento de comandos
cat <arquivo> | tr <de> <para> ▷ traduz caracteres ▷
deleta ▷ "aperta" tr translate or delete characters
▷ busca com filtros múltiplos cat random.csv | grep AC
| grep "Sr\." cat random.csv | grep João | grep AL ▷ busca + remoção de palavras cat random.csv | grep AC | sed "s/Dr. //" cat random.csv | grep GO | sed "s/Sr. //" pipes
▷ visualizar consumo de memória dos programas ps aux |
sed "s/ \+/\t/g" | cut -f 4,11- | less pipes
obrigado! @luiz_amf github.com/lamenezes
Credits Special thanks to all the people who made and
released these awesome resources for free: ▷ Presentation template by SlidesCarnival