Currently, i have to manually stream the edited content into a new file and then rename the new file to the original file name I'm debugging a shell script and trying to find out the task performed by the following command Sed with special characters asked 14 years, 6 months ago modified 2 years, 11 months ago viewed 90k times Use this solution with gnu sed Sed ':a;n;$!ba;s/\n/ /g' file this will read the whole file in a loop (':a;n;$!ba), then replaces the newline (s) with a space (s/\n/ /g) Additional substitutions can be simply appended if needed
Sed starts by reading the first line excluding the newline into the pattern space Create a label via :a Append a newline and next line to the pattern. I have this line inside a file Sed 's/^m//g' however, this removes ^m and I run this command to find and replace all occurrences of 'apple' with 'orange' in all files in root of my site
The following command is correctly changing the contents of 2 files How to use variables in a command in sed Asked 12 years, 1 month ago modified 2 years, 3 months ago viewed 200k times I'm trying to replace all references of a package named boots in a configuration file How would i use sed to delete all lines in a text file that contain a specific string?
WATCH