How to use sed to replace multiple chars in a string??

I want to replace some chars of a string with sed. I tried the following two approaches, but I need to know if ther...

Shell script - remove first and last quote (") from a variable?

Below is the snippet of a shell script from a larger script. It removes the quotes from the string that is held by a...

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 example, to remove lines from...

Using SED with wildcard?

I want to replace a string with wildcard but it doesn't work. The string looks like "some-string-8" I wrote sed -...

How to use sed to extract substring?

I have a file containing the following lines: <parameter name="PortMappingEnabled" access="readWrite" type="xs...

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 thi...

How to remove trailing whitespaces with sed??

I have a simple shell script that removes trailing whitespace from a file. Is there any way to make this script more...

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.suepearson.co.uk/p...

Select a particular column using awk or cut or perl?

I have a requirement to select the 7th column from a tab delimited file. eg: cat filename | awk '{print $7}' The ...

unix tr find and replace?

This is the command I'm using on a standard web page I wget from a web site. tr '<' '\n<' < index.html h...

How can I replace a newline with its escape sequence??

Using sed to make text that contains certain characters suitable for use in string literals is straightforward: sed...