LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-05-2008, 04:35 PM   #16
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957

Why don't you simply open inittab with your favorite text editor?



UAH UAH UAH... YOU MAKE ME LAUGH!

Seriously, now. Here is the dirty way:
Code:
cp -p /etc/inittab /etc/inittab.bck
sed -i 's%ca::ctrlaltdel:/sbin/shutdown -t3 -r now%# Changed 8-5-08 -dfezz1 (disabling ctrl-alt-del at console)\nca:12345:ctrlaltdel:/bin/echo "CTRL-ALT-DEL is disabled"%' /etc/inittab
The -i option of sed edits the file in place (hence the backup copy). After the substitute 's' command of sed you can use any character as separator: when you have slashes in the pattern you can escape them using a backslash or chose another separator, as the percent sign in my example. Also you can insert a newline character in the replacement string to span the output on two consecutive lines. Just a dirty way, I know. I will think about a better one for the next couple of minutes!
 
  


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
Text replacement question: sed/awk/perl whatever BigRedBall Programming 6 02-05-2008 12:53 PM
Replacing text on specific lines with sed or awk? Lantzvillian Linux - Newbie 5 10-17-2007 10:00 AM
awk/sed to grep the text ahpin Linux - Software 3 10-17-2007 01:34 AM
SED, AWK or PERL HELP embsupafly Programming 6 08-20-2005 10:07 PM
Help with a script to edit text file (awk? sed?) rickh Linux - Newbie 8 04-21-2005 09:24 PM


All times are GMT -5. The time now is 03:21 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration