You're viewing a comment by Gajendran V.R. and its responses.

Gajendran V.R. Permalink
March 18, 2012, 08:12

i want to grep the word "nfs" in /etc/fstab then comment the line using #. can any one ping the one liner please :)

Comment Responses

May 14, 2012, 13:25

Here you go (in awk):

awk '/nfs/ { print "#" $0; next } { print $0 }'

Or in sed:

sed '/nfs/s/^/#/'

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "coding_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.