adrianlarion / useful-sed Goto Github PK
View Code? Open in Web Editor NEWUseful sed scripts & patterns.
Useful sed scripts & patterns.
Hi,
Thanks for useful tips.
Although I try to do "Keep the first word of every line" example, it doesn't seem to work.
Could you check it please.
Regards,
% sed --version
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: <[email protected]>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
% sed -E 's_[a-zA-Z0-9_]+.*_\1_' /etc/passwd
sed: -e expression #1, char 21: invalid reference \1 on `s' command's RHS
You might want to do like this maybe.
% sed -E 's_([a-zA-Z0-9_]+).*_\1_' /etc/passwd
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
operator
games
ftp
nobody
systemd
dbus
polkitd
sshd
postfix
chrony
rpc
ntp
tss
apache
rpcuser
nfsnobody
abrt
libstoragemgmt
tcpdump
stap
uuidd
unbound
Can I push some translated documents to this repo?
hi,
curl cheat.sh/sed
already gives some nice examples, may be merge missing ones from your manual?
cheers.
One liner "Delete empty files" should be "Delete empty lines"
Credit goes to redditor /u/dontchooseanickname
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.