Top "Sed" questions

Sed (Stream EDitor) is a command line editor for POSIX environment.

Non greedy (reluctant) regex matching in sed?

I'm trying to use sed to clean up lines of URLs to extract just the domain. So from: http://www.…

regex sed pcre greedy regex-greedy
How to show only next line after the matched one?

grep -A1 'blah' logfile Thanks to this command for every line that has 'blah' in it, I get the output …

awk sed grep
How to merge every two lines into one from the command line?

I have a text file with the following format. The first line is the "KEY" and the second line is …

bash awk sed grep
sed: print only matching group

I want to grab the last two numbers (one int, one float; followed by optional whitespace) and print only them. …

regex sed
How to use sed to remove the last n lines of a file

I want to remove some n lines from the end of a file. Can this be done using sed? For …

linux bash shell sed
How can I strip first X characters from string using sed?

I am writing shell script for embedded Linux in a small industrial box. I have a variable containing the text …

bash shell sed
How to extract string following a pattern with grep, regex or perl

I have a file that looks something like this: <table name="content_analyzer" primary-key="id"> <type="global" /&…

regex perl sed html-parsing text-extraction
Is there any sed like utility for cmd.exe?

I want to programmatically edit file content using windows command line (cmd.exe). In *nix there is sed for this …

windows sed cmd
How to extract text from a string using sed?

My example string is as follows: This is 02G05 a test string 20-Jul-2012 Now from the above string I want …

regex bash sed
What is the difference between sed and awk?

What is the difference between awk and sed ? What kind of application are best use cases for sed and awk …

sed awk