SlideShare a Scribd company logo
grep | sed | awk | xargs | etcPractical *nix utilities(for text processing)
whoami
/awkcatgreptacsedecholsdutestmvsplittaildirjoinwcheadvimtrsortsumcutexpruniqpastekilltee
/LogMega AppFilesDB
pwd | ls | find | teeGNU Coreutilshttp://www.gnu.org/software/coreutils/The takeaway command:man> info coreutils
pwd | ls | find | teeList of files:ls –lls–1ls –latrfind . –name *.txt
pwd | ls | find | teeSeek for a string in a file:grep“cat” file.txtgrep –v “dog” file.txtgrep –i “PaTtErN” file.txtegrep“cat|dog” file.txtzgrep“cat” file.txt.gz
for / xargsDo something with each file:for file in `find . –name *tmp` dorm$file donefind . –name *tmp| xargsrm
pwd | ls | find | teefind + grepfind . -name '*txt' -exec grep-l aaa{} \;find . -name '*txt' | xargsgrep-l aaa
pwd | ls | find | teecatgreptacecholsdutestmvsplittaildirjoinwcheadtrsortsumcutexpruniqpastekilltee
paste
join
sort | uniq
wc
cut
csplit
awksed
sedsfor substitutionsed‘s/cat/dog/’ # cat -> dogsed ‘s/\(a\)\(b\)/\2\1/’# ab-> ba
sedpfor printingsed –n ‘/dog/p’ # print lines that match ‘dog’sed–n ‘/start/,/end/p’# print range
seddto deletesed ‘/dog/d’# delete lines that match ‘dog’sed ‘1,/pattern/d’# delete range
sed| and –e for invocationsed ‘s/a/A/’ | sed ‘s/b/B/’#sed –e ‘s/a/A/’ –e ‘s/b/B/’ #
sed{ .. } to group the commandssed ‘/pattern/ {       s/p/P/       s/e/E/    }’#pattern -> PattErn
sedrto read a filesed ‘/include/ r file.txt’# insert file.txt after includewto write to a filesed‘/pattern/ w file.txt’# write matched lines to a file
sedtris
awkaaabbb cccaaabbbzzzawk '/zzz/'  1.txt  grepzzz    1.txtaaabbbzzz
awkawk'BEGIN{<initializations>}<pattern 1> {<actions>}<pattern 2> {<actions>}... END{<final actions>}'
awkawk'BEGIN{a=0, b=0} /aaa/{a++} /bbb/   {b++}END{printf “%d\t%d”,a,b}'
awkawk'{arr[$2]+=$1} END { for (id in arr) printf "%s\t%d\t\n",id,arr[id]}'
exit@antonarhipov

More Related Content

PPT
Unix command-line tools
Eric Wilson
 
PPTX
Pig workshop
Sudar Muthu
 
ODP
Love Your Command Line
Liz Henry
 
PDF
Practical pig
trihug
 
PDF
Semantic Pipes (London Perl Workshop 2009)
osfameron
 
PPT
Python - Getting to the Essence - Points.com - Dave Park
pointstechgeeks
 
PDF
What we can learn from Rebol?
lichtkind
 
PDF
KubeCon EU 2016: Custom Volume Plugins
KubeAcademy
 
Unix command-line tools
Eric Wilson
 
Pig workshop
Sudar Muthu
 
Love Your Command Line
Liz Henry
 
Practical pig
trihug
 
Semantic Pipes (London Perl Workshop 2009)
osfameron
 
Python - Getting to the Essence - Points.com - Dave Park
pointstechgeeks
 
What we can learn from Rebol?
lichtkind
 
KubeCon EU 2016: Custom Volume Plugins
KubeAcademy
 

What's hot (20)

PPTX
Cscope and ctags
Saikat Megamind
 
PDF
Fast and cost effective geospatial analysis pipeline with AWS lambda
Mila Frerichs
 
PPTX
2015 bioinformatics python_strings_wim_vancriekinge
Prof. Wim Van Criekinge
 
KEY
Txjs
Peter Higgins
 
PDF
Why Python (for Statisticians)
Matt Harrison
 
PDF
Course 102: Lecture 7: Simple Utilities
Ahmed El-Arabawy
 
PPTX
Parse, scale to millions
Florent Vilmart
 
PPT
Introduction to Perl
Sway Wang
 
PPTX
Value protocols and codables
Florent Vilmart
 
PPT
Advanced linux chapter ix-shell script
Eliezer Moraes
 
PDF
7 Common Mistakes in Go (2015)
Steven Francia
 
PDF
Go初心者がGoでコマンドラインツールの作成に挑戦した話
dcubeio
 
PDF
Ansible ハンズオン on AWS - DevelopersIO 2017
Shuji Watanabe
 
PDF
JIP Pipeline System Introduction
thasso23
 
TXT
Logrotate sh
Ben Pope
 
PDF
Introduction to source{d} Engine and source{d} Lookout
source{d}
 
KEY
My life as a beekeeper
Pedro Figueiredo
 
PPTX
File handling in c language
Harish Gyanani
 
PDF
A Python Crash Course
Alex-P. Natsios
 
PPT
Rotzy - Building an iPhone Photo Sharing App on Google App Engine
geehwan
 
Cscope and ctags
Saikat Megamind
 
Fast and cost effective geospatial analysis pipeline with AWS lambda
Mila Frerichs
 
2015 bioinformatics python_strings_wim_vancriekinge
Prof. Wim Van Criekinge
 
Why Python (for Statisticians)
Matt Harrison
 
Course 102: Lecture 7: Simple Utilities
Ahmed El-Arabawy
 
Parse, scale to millions
Florent Vilmart
 
Introduction to Perl
Sway Wang
 
Value protocols and codables
Florent Vilmart
 
Advanced linux chapter ix-shell script
Eliezer Moraes
 
7 Common Mistakes in Go (2015)
Steven Francia
 
Go初心者がGoでコマンドラインツールの作成に挑戦した話
dcubeio
 
Ansible ハンズオン on AWS - DevelopersIO 2017
Shuji Watanabe
 
JIP Pipeline System Introduction
thasso23
 
Logrotate sh
Ben Pope
 
Introduction to source{d} Engine and source{d} Lookout
source{d}
 
My life as a beekeeper
Pedro Figueiredo
 
File handling in c language
Harish Gyanani
 
A Python Crash Course
Alex-P. Natsios
 
Rotzy - Building an iPhone Photo Sharing App on Google App Engine
geehwan
 
Ad

Viewers also liked (20)

PDF
Defeating The Network Security Infrastructure V1.0
Philippe Bogaerts
 
PDF
class12_Networking2
T. J. Saotome
 
PDF
Unix Command Line Productivity Tips
Keith Bennett
 
PDF
PHP Secure Programming
Balavignesh Kasinathan
 
KEY
Sed & awk the dynamic duo
Joshua Thijssen
 
PDF
Web Application Security: Introduction to common classes of security flaws an...
Thoughtworks
 
PPTX
Secure SHell
Çağrı Çakır
 
PPT
Secure shell protocol
Baspally Sai Anirudh
 
PDF
How to Setup A Pen test Lab and How to Play CTF
n|u - The Open Security Community
 
PDF
Web Application Security with PHP
jikbal
 
PPT
Learning sed and awk
Yogesh Sawant
 
PPT
Practical Example of grep command in unix
Javin Paul
 
PDF
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Michael Coates
 
PDF
SSH - Secure Shell
Peter R. Egli
 
PPTX
Secure Shell(ssh)
Pina Parmar
 
PDF
SSH
Zach Dennis
 
PDF
Top 100 Linux Interview Questions and Answers 2014
iimjobs and hirist
 
ODT
RHCE FINAL Questions and Answers
Radien software
 
PPT
Introduction to SSH
Hemant Shah
 
PDF
Linux Systems Performance 2016
Brendan Gregg
 
Defeating The Network Security Infrastructure V1.0
Philippe Bogaerts
 
class12_Networking2
T. J. Saotome
 
Unix Command Line Productivity Tips
Keith Bennett
 
PHP Secure Programming
Balavignesh Kasinathan
 
Sed & awk the dynamic duo
Joshua Thijssen
 
Web Application Security: Introduction to common classes of security flaws an...
Thoughtworks
 
Secure SHell
Çağrı Çakır
 
Secure shell protocol
Baspally Sai Anirudh
 
How to Setup A Pen test Lab and How to Play CTF
n|u - The Open Security Community
 
Web Application Security with PHP
jikbal
 
Learning sed and awk
Yogesh Sawant
 
Practical Example of grep command in unix
Javin Paul
 
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Michael Coates
 
SSH - Secure Shell
Peter R. Egli
 
Secure Shell(ssh)
Pina Parmar
 
Top 100 Linux Interview Questions and Answers 2014
iimjobs and hirist
 
RHCE FINAL Questions and Answers
Radien software
 
Introduction to SSH
Hemant Shah
 
Linux Systems Performance 2016
Brendan Gregg
 
Ad

Similar to Practical unix utilities for text processing (20)

DOC
Treebeard's Unix Cheat Sheet
wensheng wei
 
PDF
Os lab manual
Neelamani Samal
 
PDF
Unit 8 text processing tools
root_fibo
 
ODP
Unix tips and tricks
Aleksandar Bilanovic
 
PDF
Workshop on command line tools - day 1
Leandro Lima
 
PPT
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS
 
PPT
Linux
SINGH PROJECTS
 
PDF
Linux Bash Shell Cheat Sheet for Beginners
Davide Ciambelli
 
PDF
113-1_Perl_2_Linux_commands_for_beginner.pdf
ThoVyNguynVng
 
PDF
Unix / Linux Command Reference
Sumankumar Panchal
 
PDF
Unix commands
selvamanisampath
 
PDF
Unix Cheat Sheet
Loiane Groner
 
PDF
Unix
akaash08
 
PDF
Unix
yarmuqam
 
PPT
Unix Basics
Dr.Ravi
 
PDF
Course 102: Lecture 3: Basic Concepts And Commands
Ahmed El-Arabawy
 
PPT
Karkha unix shell scritping
chockit88
 
DOCX
Directories description
Dr.M.Karthika parthasarathy
 
Treebeard's Unix Cheat Sheet
wensheng wei
 
Os lab manual
Neelamani Samal
 
Unit 8 text processing tools
root_fibo
 
Unix tips and tricks
Aleksandar Bilanovic
 
Workshop on command line tools - day 1
Leandro Lima
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS
 
Linux Bash Shell Cheat Sheet for Beginners
Davide Ciambelli
 
113-1_Perl_2_Linux_commands_for_beginner.pdf
ThoVyNguynVng
 
Unix / Linux Command Reference
Sumankumar Panchal
 
Unix commands
selvamanisampath
 
Unix Cheat Sheet
Loiane Groner
 
Unix
akaash08
 
Unix
yarmuqam
 
Unix Basics
Dr.Ravi
 
Course 102: Lecture 3: Basic Concepts And Commands
Ahmed El-Arabawy
 
Karkha unix shell scritping
chockit88
 
Directories description
Dr.M.Karthika parthasarathy
 

More from Anton Arhipov (20)

PDF
JavaZone 2022 - Building Kotlin DSL.pdf
Anton Arhipov
 
PDF
Idiomatic kotlin
Anton Arhipov
 
PDF
TechTrain 2019 - (Не)адекватное техническое интервью
Anton Arhipov
 
PDF
Build pipelines with TeamCity
Anton Arhipov
 
PDF
Build pipelines with TeamCity
Anton Arhipov
 
PDF
Devoxx Ukraine 2018 - Kotlin DSL in under an hour
Anton Arhipov
 
PDF
GeeCON Prague 2018 - Kotlin DSL in under an hour
Anton Arhipov
 
PDF
Build pipelines with TeamCity and Kotlin DSL
Anton Arhipov
 
PDF
Build pipelines with TeamCity
Anton Arhipov
 
PDF
JavaDay Kiev 2017 - Integration testing with TestContainers
Anton Arhipov
 
PDF
GeeCON Prague 2017 - TestContainers
Anton Arhipov
 
PDF
JavaOne 2017 - The hitchhiker’s guide to Java class reloading
Anton Arhipov
 
PDF
JavaOne 2017 - TestContainers: integration testing without the hassle
Anton Arhipov
 
PDF
JavaOne 2017 - The hitchhiker’s guide to Java class reloading
Anton Arhipov
 
PDF
JavaZone 2017 - The Hitchhiker’s guide to Java class reloading
Anton Arhipov
 
PDF
JUG.ua 20170225 - Java bytecode instrumentation
Anton Arhipov
 
PDF
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Anton Arhipov
 
PDF
GeeCON 2017 - TestContainers. Integration testing without the hassle
Anton Arhipov
 
PDF
JEEConf 2017 - The hitchhiker’s guide to Java class reloading
Anton Arhipov
 
PDF
JEEConf 2017 - Having fun with Javassist
Anton Arhipov
 
JavaZone 2022 - Building Kotlin DSL.pdf
Anton Arhipov
 
Idiomatic kotlin
Anton Arhipov
 
TechTrain 2019 - (Не)адекватное техническое интервью
Anton Arhipov
 
Build pipelines with TeamCity
Anton Arhipov
 
Build pipelines with TeamCity
Anton Arhipov
 
Devoxx Ukraine 2018 - Kotlin DSL in under an hour
Anton Arhipov
 
GeeCON Prague 2018 - Kotlin DSL in under an hour
Anton Arhipov
 
Build pipelines with TeamCity and Kotlin DSL
Anton Arhipov
 
Build pipelines with TeamCity
Anton Arhipov
 
JavaDay Kiev 2017 - Integration testing with TestContainers
Anton Arhipov
 
GeeCON Prague 2017 - TestContainers
Anton Arhipov
 
JavaOne 2017 - The hitchhiker’s guide to Java class reloading
Anton Arhipov
 
JavaOne 2017 - TestContainers: integration testing without the hassle
Anton Arhipov
 
JavaOne 2017 - The hitchhiker’s guide to Java class reloading
Anton Arhipov
 
JavaZone 2017 - The Hitchhiker’s guide to Java class reloading
Anton Arhipov
 
JUG.ua 20170225 - Java bytecode instrumentation
Anton Arhipov
 
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Anton Arhipov
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
Anton Arhipov
 
JEEConf 2017 - The hitchhiker’s guide to Java class reloading
Anton Arhipov
 
JEEConf 2017 - Having fun with Javassist
Anton Arhipov
 

Recently uploaded (20)

PDF
DevOps & Developer Experience Summer BBQ
AUGNYC
 
PPT
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
PDF
Chapter 1 Introduction to CV and IP Lecture Note.pdf
Getnet Tigabie Askale -(GM)
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
DevOps & Developer Experience Summer BBQ
AUGNYC
 
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
Chapter 1 Introduction to CV and IP Lecture Note.pdf
Getnet Tigabie Askale -(GM)
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
Coupa-Overview _Assumptions presentation
annapureddyn
 
Doc9.....................................
SofiaCollazos
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 

Practical unix utilities for text processing