Just pipe it through awk or sed? Though, a brush up on regular expressions never hurts.
Yes they’re still being actively developed, but for the most part it’s more about bug fixes, performance, and portability than features.
These tools adopt the philosophy of “do one thing and do it well”. So if they do that thing well, the maintainers aren’t very eager to tack on more features.
Each of the major tools have their own page on gnu.org. You can see the mailing list is still active.
`sed (GNU sed) 4.2.2 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <>.
Be sure to include the word sed'' somewhere in the
Subject:'' field.`
/usr/bin/bash
>I have a script that binds a few hotkeys. But depending on if I have an external keyboard connected or not, I want to switch two lines.
Sounds like you want a udev-rule and <code>sed</code>. But it's hard to tell for sure.
The difficulty (for me at least) in that case is: what do you use for a record separator? Because awk
works on one record at time, and so isn't terribly useful for comparing records (AFAIK).
I'm guessing what you want is sed
(Gnu manual), but I don't know for sure, because I have even worse skills with sed
than with awk
.
(Personally, I'd probably loop through grep
for each PID, load the times into an array, and fiddle with that, but I'm hardly someone who's BASH habits should be emulated. “Horrifying” is probably the best adjective to describe my scripts.)
Yeah I only learned that a couple weeks ago, oddly.
They're strictly in the GNU sed, so basically everywhere except like... Macs and bsd-based stuff for the most part.
Reading: http://www.gnu.org/software/sed/manual/sed.html#Escapes
This sent me on a spree searching for information on why one would use [[:space:]] instead of \s. It seems \s is not POSIX [1], although my sed (4.2.1) supports it without any flag magic even though it is not mentioned in the documentation [2]. Should there be a /r/mildlyinterestingcommandline ...or should I perhaps just go to bed instead...