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
Ruby One-Liners
Search
bjelli
March 23, 2012
Programming
340
1
Share
Ruby One-Liners
A lightning talk at Salzburg Barcamp "The Next Web" in March 2012.
bjelli
March 23, 2012
More Decks by bjelli
See All by bjelli
Intro to Web- and Mobile-Developement
bjelli
0
320
Railsgirls: Where did my HTML and CSS go
bjelli
0
600
Berufe im World Wide Web
bjelli
0
270
Javascript Closures
bjelli
3
900
Teach (all the) Rails
bjelli
0
450
Other Decks in Programming
See All in Programming
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
230
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
470
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
120
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
140
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
980
AIエージェントの隔離技術の徹底比較
kawayu
0
420
ReactとSvelteのその先、Ripple-TS / Beyond React and Svelte: Ripple-TS
ssssota
3
710
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
1
470
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
200
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
210
cloudnative conference 2026 flyle
azihsoyn
1
200
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
240
Featured
See All Featured
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
810
Between Models and Reality
mayunak
4
300
Bash Introduction
62gerente
615
210k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
570
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
390
The Limits of Empathy - UXLibs8
cassininazir
1
340
Technical Leadership for Architectural Decision Making
baasie
3
370
Color Theory Basics | Prateek | Gurzu
gurzu
0
310
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
150
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
300
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Scaling GitHub
holman
464
140k
Transcript
Ruby One-Liner
mit -e Programmcode angeben ruby -e ' puts "hello" '
ruby -e 'puts "Hello"' mit -e Programm angeben
ruby -e 'puts 24 * 60 * 60 ' mein
Taschenrechner
ruby -p -e '' langer.txt -p print-schleife über datei
ruby -p -e 'puts' langer.txt leerzeile nach jeder zeile
ruby -p -e 'puts $_.length' langer.txt $_ enthält die Zeile
ruby -p -e 'puts "#{$.}.Zeile hat länge #{$_.length} " '
langer.txt $. enthält die Zeilennummer
Korrektur • es geht nicht um Zeilen • sondern um
"Records" • default: Record-Separator ist "\n" • deswegen wird zeilenweise gelesen • Der Separator ist in der Variable $/
ruby -00 -p -e 'puts "#{$.}.Absatz hat länge #{$_.length} "
' l.txt -00 verwende doppelten separator Absatz statt Zeile
ruby -p -e 'puts "."' index.html -n schleif, nicht ausgeben
ruby -n -e 'puts if /Schokolade/' index.html Finden grep
ruby -p -e 'gsub(/Game/, "Web")' index.html Ersetzen
ruby -i.bak -p -e 'gsub(/Game/, "Web")' index.html Ersetzen in der
Datei neu in index.html, alt in index.html.bak
ruby -i.bak -p -e 'gsub(/Game/, "Web")' *.html Ersetzen in vielen
Dateien
ruby command line switches + ruby one-liners + unix |
Learn More