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
Practical unix utilities for text processing
Search
Anton Arhipov
October 01, 2010
Technology
0
65
Practical unix utilities for text processing
Anton Arhipov
October 01, 2010
Tweet
Share
More Decks by Anton Arhipov
See All by Anton Arhipov
Strengthening Immutability in Kotlin. A Glimpse into Valhalla
antonarhipov
2
21
Levels of AI-assisted programming
antonarhipov
0
57
Devoxx France 2024. Kotlin - the new and noteworthy
antonarhipov
2
40
Harnessing the power of AI in IntelliJ IDEA
antonarhipov
1
170
VirtualJUG: Kotlin 2.0 and beyond
antonarhipov
1
120
Kotlin 2.1: Language Updates
antonarhipov
3
140
Devoxx Belgium 2024 - Kotlin 2.0 and beyond
antonarhipov
2
170
Data Analysis with Kotlin Notebook, DataFrame, and Kandy
antonarhipov
1
87
Kotlin 2.0 and Beyond
antonarhipov
2
250
Other Decks in Technology
See All in Technology
Django's GeneratedField by example - DjangoCon US 2025
pauloxnet
0
150
新アイテムをどう使っていくか?みんなであーだこーだ言ってみよう / 20250911-rpi-jam-tokyo
akkiesoft
0
250
250905 大吉祥寺.pm 2025 前夜祭 「プログラミングに出会って20年、『今』が1番楽しい」
msykd
PRO
1
830
react-callを使ってダイヤログをいろんなとこで再利用しよう!
shinaps
1
240
エラーとアクセシビリティ
schktjm
1
1.2k
「Linux」という言葉が指すもの
sat
PRO
4
130
生成AI時代のデータ基盤設計〜ペースレイヤリングで実現する高速開発と持続性〜 / Levtech Meetup_Session_2
sansan_randd
1
150
開発者を支える Internal Developer Portal のイマとコレカラ / To-day and To-morrow of Internal Developer Portals: Supporting Developers
aoto
PRO
1
460
品質視点から考える組織デザイン/Organizational Design from Quality
mii3king
0
200
allow_retry と Arel.sql / allow_retry and Arel.sql
euglena1215
1
160
Autonomous Database - Dedicated 技術詳細 / adb-d_technical_detail_jp
oracle4engineer
PRO
4
10k
【初心者向け】ローカルLLMの色々な動かし方まとめ
aratako
7
3.4k
Featured
See All Featured
BBQ
matthewcrist
89
9.8k
Building an army of robots
kneath
306
46k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
How STYLIGHT went responsive
nonsquared
100
5.8k
Designing Experiences People Love
moore
142
24k
Code Review Best Practice
trishagee
70
19k
Site-Speed That Sticks
csswizardry
10
810
Balancing Empowerment & Direction
lara
3
620
Typedesign – Prime Four
hannesfritz
42
2.8k
Done Done
chrislema
185
16k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
Transcript
grep | sed | awk | xargs | etc
None
sed vim awk ls
cat tac head tail split wc sum sort uniq kill cut paste join tr dir mv du echo test expr tee grep
DB Mega App Files Log
GNU Coreutils http://www.gnu.org/software/coreutils/ The takeaway
command: man > info coreutils
List of files: ls –l ls –1
ls –latr find . –name *.txt
Seek for a string in a file: grep
“cat” file.txt grep –v “dog” file.txt grep –i “PaTtErN” file.txt egrep “cat|dog” file.txt zgrep “cat” file.txt.gz
for file in `find . –name *tmp` do
rm $file done find . –name *tmp | xargs rm Do something with each file:
find + grep find . -‐name '*txt' -‐exec
grep -‐l aaa {} \; find . -‐name '*txt' | xargs grep -‐l aaa
ls cat tac head tail
split wc sum sort uniq kill cut paste join tr dir mv du echo test expr tee grep
None
None
None
None
None
None
sed awk
s for substitution sed ‘s/cat/dog/’ #
cat -‐> dog sed ‘s/\(a\)\(b\)/\2\1/’ # ab -‐> ba
p for printing sed –n ‘/dog/p’
# print lines that match ‘dog’ sed –n ‘/start/,/end/p’ # print range
d to delete sed ‘/dog/d’ # delete
lines that match ‘dog’ sed ‘1,/pattern/d’ # delete range
| and –e for invocation sed ‘s/a/A/’ |
sed ‘s/b/B/’ # sed –e ‘s/a/A/’ –e ‘s/b/B/’ #
{ .. } to group the commands sed
‘/pattern/ { s/p/P/ s/e/E/ }’ #pattern -‐> PattErn
r to read a file sed ‘/include/ r
file.txt’ # insert file.txt after include w to write to a file sed ‘/pattern/ w file.txt’ # write matched lines to a file
None
aaa bbb ccc aaa bbb zzz awk
'/zzz/' 1.txt grep zzz 1.txt aaa bbb zzz
awk 'BEGIN
{<initializations>} <pattern 1> {<actions>} <pattern 2> {<actions>} ... END {<final actions>}'
awk 'BEGIN {a=0, b=0}
/aaa/ {a++} /bbb/ {b++} END {printf “%d\t%d”,a,b}'
awk '{arr[$2]+=$1} END {
for (id in arr) printf "%s\t%d\t\n",id,arr[id]}'
@antonarhipov