sed
This is a wiki page. Be bold and improve it!
If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.
sed is a command line tool to transform text.
Starting with sed
The official documentation for GNU sed is not very beginner friendly.
Yet, it is very easy to get started with sed. The command:
$ sed 's/apple/banana/' file.txt
will change the first occurrence on each line of 'apple' to 'banana'.
Adding the operator 'g' (for 'global') will change all occurrences:
$ sed 's/apple/banana/g' file.txt
With the option --in-place, the file itself will be changed, instead of the result being simply output to the console:
$ sed --in-place 's/apple/banana/g' file.txt
Troubleshooting
See sub-wiki page below.
Colorize output
You might want to use grc instead:
* app-misc/grc
Homepage: http://kassiopeia.juls.savba.sk/~garabik/software/grc.html
Description: Generic Colouriser beautifies your logfiles or output of commands
External resources
-
Official resources:
- GNU sed user's manual.
- sed.
- Sed - An Introduction and Tutorial by Bruce Barnett.
Wikipédia:
Other:
Issues related to this page:
Project | Summary | Status | Priority | Category | Last updated | Assigned to |
---|---|---|---|---|---|---|
Programming | Regex: what does {N;d} mean? | active | normal | support request | 8 years 47 weeks |