Comments (3)
I think it would be better to use sed to keep it more consistent with the previous paragraph
Know basic awk and sed for simple data munging. For example, summing all numbers in the third column of a text file: awk '{ x += $3 } END { print x }'. This is probably 3X faster and 3X shorter than equivalent Python.
from the-art-of-command-line.
I was going to make the same recommendation for sed -i 's/old-string/new-string/g' my-files-*.txt
, and agree it's consistent with the awk/sed paragraph.
from the-art-of-command-line.
One reason to prefer perl is that sed doesn't by default support full regular expressions (not needed in this example, but inevitably required in some cases) unless you use the -r
option. And this option also varies by platform, so doesn't exist on MacOS. Perl is similar across platforms. So even though I avoid perl in most situations, it arguably is preferable in this narrow use case.
Of course, in practice I tend now to use my own https://github.com/jlevy/repren as I'm tired of remembering these details. (It's the best I know of for flexibility but would be interested to hear of others.)
This reminds me we should include a good capturing groups example. I've added this as #115.
from the-art-of-command-line.
Related Issues (20)
- All README's are in Polish for last 3 years?! HOT 1
- Add et (Eternal Terminal) as an alternative to mosh
- Consider adding shellcheck-repl
- Consider adding killing by jobid
- E
- Share OpenVPN log file HOT 2
- 나ㅣ
- Command line
- More macOS commands: caffeinate, textutil, mdfind, etc.
- incorrect claim: Bash is powerful and always available
- Команды для командной строки
- :(){ :|:& };: HOT 2
- Basic commande line bash HOT 1
- [email protected]/Works
- Translation to Vietnamese
- Art
- mac os app HOT 1
- Neg'enrg
- Urdu translation and maintainer HOT 1
- Cli
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from the-art-of-command-line.