LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to remove a line from a text file (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-remove-a-line-from-a-text-file-4175518023/)

apss_evaluator 09-09-2014 01:18 PM

how to remove a line from a text file
 
Hi Linux Guru's

I'm trying to find ways on how can I remove lines from a file using "SED" but still the lines do still exists.


tried this command but didnt work = sed 'pogi' sudoers

I'm trying to remove this two line from sudoers (I am root)

# pogi is enabled
halaka ALL=(ALL) NOPASSWD:/opt/hal/bin/test.sh




please enlighten me on other options that can be used

smallpond 09-09-2014 01:24 PM

Guessing doesn't work well with command line. Try reading the man page or online tutorials before using a command.

TB0ne 09-09-2014 02:30 PM

Quote:

Originally Posted by apss_evaluator (Post 5235129)
Hi Linux Guru's
I'm trying to find ways on how can I remove lines from a file using "SED" but still the lines do still exists.

tried this command but didnt work = sed 'pogi' sudoers

I'm trying to remove this two line from sudoers (I am root)

# pogi is enabled
halaka ALL=(ALL) NOPASSWD:/opt/hal/bin/test.sh

please enlighten me on other options that can be used

You've asked about sed before...have you not tried to read any documentation, or look this up??? Just putting "how to delete a line from a file using sed" into Google give you THOUSANDS of examples:
http://www.theunixschool.com/2012/06...e-line-or.html

Please try to do basic research on your own, before posting, and try to apply what you've been told in previous threads.

keefaz 09-09-2014 02:34 PM

Use visudo, position cursor on first line to delete, type "dd" two times then ":wq", done

schneidz 09-09-2014 03:07 PM

maybe grep would be better suited:
Code:

grep -v "(pogi is enabled|halaka ALL=\(ALL\) NOPASSWD:/opt/hal/bin/test.sh)" /whatever/floats/your/boat
?


All times are GMT -5. The time now is 01:23 AM.