Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use tr to substitute '--' string

Tags:

linux

bash

shell

I have an output:

--
out1
--
out2
--
out3

I want to get the output:

out1
out2
out3

I thought of using:

tr '--' ''

but it doesn't recognize '--' to be the first string I want to substitute. How do I solve this?

like image 936
Guy Avatar asked Oct 26 '25 04:10

Guy


1 Answers

cat file | sed '/^--/d'
like image 118
Amro Avatar answered Oct 28 '25 19:10

Amro