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
0
65
Processando textos enormes com ferramentas "Unix"
Palestra dada no evento "Linux em Prosa" do sancaLUG.
Luiz Menezes
February 11, 2017
Tweet
Share
More Decks by Luiz Menezes
See All by Luiz Menezes
async é bom, async eu gosto
luizmenezes
0
51
Testando aplicações web com py.test e selenium
luizmenezes
0
140
Python 3 Orientado a Objetos
luizmenezes
3
320
Expondo o Raspberry Pi via servidor web
luizmenezes
0
95
Workshop Django
luizmenezes
2
260
Bottle Admin
luizmenezes
0
110
IoT, Raspberry Pi e Python
luizmenezes
1
82
Coding Dojo
luizmenezes
0
63
Featured
See All Featured
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
230
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
140
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
98
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Navigating Weather and Climate Data
rabernat
0
130
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
970
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
82
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
330
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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