Question

I need delete all lines that end with :.

List example:

name1
name2
name3:
name4
name5:

I need convert this to:

name1
name2
name4

Another example:

name1
:name2
name3
:name4

Convert to:

name1
name3

Thanks in Advance :*

Was it helpful?

Solution

Try using sed

sed -r '/^:|:$/d' file

EDIT

If you have leading or trailing spaces in a line, try adding \s*

sed -r '/^\s*:|:\s*$/d' file
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top