Top "Sed" questions

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

Printing with sed or awk a line following a matching pattern

Question: I'd like to print a single line directly following a line that contains a matching pattern. My version of …

awk sed
The easiest way to replace white spaces with (underscores) _ in bash

recently I had to write a little script that parsed VMs in XenServer and as the names of the VMs …

bash sed
sed fails with "unknown option to `s'" error

I'm trying to use sed -i -e "s/.*seb.*/ \"$ftp_login_template\"/" $ftp_dir however I get this error: sed: …

sed
How to find and replace all occurrences of a string recursively in a directory tree?

Using just grep and sed, how do I replace all occurrences of: a.example.com with b.example.com within …

sed find grep replace
invalid command code ., despite escaping periods, using sed

Being forced to use CVS for a current client and the address changed for the remote repo. The only way …

bash macos sed
sed whole word search and replace

How do I search and replace whole words using sed? Doing sed -i 's/[oldtext]/[newtext]/g' <file> …

shell sed
How to delete duplicate lines in a file without sorting it in Unix?

Is there a way to delete duplicate lines in a file in Unix? I can do it with sort -u …

unix shell scripting sed awk
Why is sed not recognizing \t as a tab?

sed "s/\(.*\)/\t\1/" $filename > $sedTmpFile && mv $sedTmpFile $filename I am expecting this sed script to insert a …

regex bash sed
How can I delete a newline if it is the last character in a file?

I have some files that I'd like to delete the last newline if it is the last character in a …

linux perl shell awk sed
Command line: search and replace in all filenames matched by grep

I'm trying to search and replace a string in all files matched by grep: grep -n 'foo' * will give me …

linux perl awk sed grep