It looks like the origin of this was JSON data - if so, consider using a tool like jq that would allow you to extract the raw parameter value directly. character include the "." But it is sed's ability to filter text in a pipeline which . Tags: Shell Example. sed remove everything after last occurrence of character code … If we assume that each line between the {} container is an XML document then What I want to remove the newline character from all lines within each container to have one XMDL document per line I wrote a bit of sed after trawling the web: e.g. If you just append a newline delimiter after your matched string you can P rint only so much of pattern space without having to modify it overmuch. With sed, everything is rather easy when it comes to text manipulation. The syntax is as follows for find and replace text with sed: The “. ” (dot) indicates any character in sed, and the “ $ ” indicates the end of the line. In other words “ .$ ” means, delete the last character only. In the replacement, by having \1 only the group is retained, leaving out the remaining part. sed -n 's|HTTP/1.0” 200|&\n|;P'