Top "Sed" questions

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

How to delete from a text file, all lines that contain a specific string?

How would I use sed to delete all lines in a text file that contain a specific string?

shell sed text-parsing in-place
How can I replace a newline (\n) using sed?

How can I replace a newline ("\n") with a space ("") using the sed command? I unsuccessfully tried: sed 's#\n# #…

sed
Find and replace in file and overwrite file doesn't work, it empties the file

I would like to run a find and replace on an HTML file through the command line. My command looks …

shell unix sed io-redirection
How can I remove the first line of a text file using bash/sed script?

I need to repeatedly remove the first line from a huge text file using a bash script. Right now I …

bash scripting sed
How to do a recursive find/replace of a string with awk or sed?

How do I find and replace every occurrence of: subdomainA.example.com with subdomainB.example.com in every text file …

bash sed awk replace
Replace whole line containing a string using Sed

I have a text file which has a particular line something like sometext sometext sometext TEXT_TO_BE_REPLACED sometext …

string shell sed
How can I extract a predetermined range of lines from a text file on Unix?

I have a ~23000 line SQL dump containing several databases worth of data. I need to extract a certain section of …

unix command-line sed text-processing
Bash tool to get nth line from a file

Is there a "canonical" way of doing that? I've been using head -n | tail -1 which does the trick, but …

bash shell unix awk sed
Delete empty lines using sed

I am trying to delete empty lines using sed: sed '/^$/d' but I have no luck with it. For …

linux unix sed
How to use sed/grep to extract text between two words?

I am trying to output a string that contains everything between two words of a string: input: "Here is a …

string bash sed grep