LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-25-2017, 08:15 AM   #16
bmxakias
Member
 
Registered: Jan 2016
Posts: 244

Original Poster
Rep: Reputation: Disabled

None work

This one just display the contents of the file:

Quote:
sed '/Added by Fail2Ban/d' /etc/csf/csf.deny

And this one:

Quote:
sed -i 's/Added by Fail2Ban/d' /etc/csf/csf.deny
report an error:

Quote:
sed: -e expression #1, char 21: unterminated `s' command
Any ideas?

Thank you

Last edited by bmxakias; 08-25-2017 at 08:19 AM.
 
Old 08-25-2017, 08:24 AM   #17
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,314
Blog Entries: 13

Rep: Reputation: 4370Reputation: 4370Reputation: 4370Reputation: 4370Reputation: 4370Reputation: 4370Reputation: 4370Reputation: 4370Reputation: 4370Reputation: 4370Reputation: 4370
Code:
sed '/pattern to match/d' input-file
is correct.

Since you have spaces in your pattern you should delimit those spaces with the backslash.

Code:
sed '/not delimited pattern/d'  input-file // probably will not work
sed '/yes\ delimited\ pattern/d' input-file // probably will work
 
1 members found this post helpful.
Old 08-25-2017, 09:58 AM   #18
bmxakias
Member
 
Registered: Jan 2016
Posts: 244

Original Poster
Rep: Reputation: Disabled
It works thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Inserting Text lines in a Text file that is existing via Bashscript techjaymindave Linux - Newbie 15 03-14-2017 09:12 AM
Remove lines in a text file based on another text file asiandude Programming 10 01-29-2009 10:59 AM
Adding lines of text to beginning of a text file BillKat Programming 2 01-19-2009 10:40 AM
print a text file with long lines and line number added powah Linux - General 2 05-26-2006 02:02 PM
Grab text lines in text file LULUSNATCH Programming 1 12-02-2005 10:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration