Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using sed...how do I

Status
Not open for further replies.

Flipster

MIS
Jun 25, 2001
38
0
0
US
Using sed...how do I delete lines beginning with a bracket?

I have tried

>sed -e '^[/d' test.txt


How would I delete a line that begins with a bracket and ends with a bracket?

I know I am missing something with regards to the bracket acting like a special character. Any help would be appreciated.
 
To delete a line which starts with a bracket

sed '/^\[/d' input-file

To delete a line which starts and ends with a bracket

sed '/^\[.*\]$/d' input-file

CaKiwi
 
sed -e '/^\[.*\]$/d' file.txt vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top