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
64
Practical unix utilities for text processing
Anton Arhipov
October 01, 2010
Tweet
Share
More Decks by Anton Arhipov
See All by Anton Arhipov
Levels of AI-assisted programming
antonarhipov
0
4
Devoxx France 2024. Kotlin - the new and noteworthy
antonarhipov
1
24
Harnessing the power of AI in IntelliJ IDEA
antonarhipov
1
120
VirtualJUG: Kotlin 2.0 and beyond
antonarhipov
1
110
Kotlin 2.1: Language Updates
antonarhipov
3
110
Devoxx Belgium 2024 - Kotlin 2.0 and beyond
antonarhipov
2
150
Data Analysis with Kotlin Notebook, DataFrame, and Kandy
antonarhipov
1
65
Kotlin 2.0 and Beyond
antonarhipov
2
230
Kotlin Standard Library Gems
antonarhipov
2
500
Other Decks in Technology
See All in Technology
ソフトウェアテストのAI活用_ver1.10
fumisuke
0
210
CloudTrailも、GuardDutyも、VPC Flow logsも… ログ多すぎ問題の整理術
nikuyoshi
5
610
Redmineの意外と知らない便利機能 (Redmine 6.0対応版)
vividtone
0
1k
AIのための オンボーディングドキュメントを整備する - hirotea
hirotea
9
2.2k
それでもぼくらは貢献をつづけるのだ(たぶん) @FOSS4GLT会#002
furukawayasuto
1
260
iOS/Androidで無限循環Carousel表現を考えてみる
fumiyasac0921
0
120
Cloud Run を解剖して コンテナ監視を考える / Breaking Down Cloud Run to Rethink Container Monitoring
aoto
PRO
0
110
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
3
1.5k
令和トラベルQAのAI活用
seigaitakahiro
0
470
Scale Security Programs with Scorecarding
ramimac
0
380
GitHub Coding Agent 概要
kkamegawa
1
1.2k
Eight Engineering Unit 紹介資料
sansan33
PRO
0
3.1k
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.1k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.6k
Typedesign – Prime Four
hannesfritz
41
2.6k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Designing Experiences People Love
moore
142
24k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
6
650
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
42
2.3k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
1
67
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
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