Microsoft
Software
Hardware
Network
Question : Sed help
Hello,
I have got a file pattern like below:
#cat test
PermitRootLogin yes
#PermitRootLogin yes
PermitRootLogin no # some text
PermitRootLogin some text
##PermitRootLogin yes
I need a Sed command that will replace all the lines "PermitRootLogin" entries into following format:
PermitRootLogin no
PermitRootLogin no
PermitRootLogin no
PermitRootLogin no
PermitRootLogin no
I tried with the following but it not working fully,
sed 's/PermitRootLogin.*$/Perm
itRootLogi
n no/' test
Please let me know. Thanks !
Answer : Sed help
sed -e 's/^.*PermitRootLogin.*$/P
ermitRootL
ogin\ no/g' file > file.new
Random Solutions
How to disable VMWare View 4 Connection bar with RDP?
Extract output from string
Cisco 6509 SUP720 IPv4 CEF Entries
split columns in word
Finalizing Migration From Exchange 2003 to Exchange 2010
How to replace all onclick events to ontouchstart using jQuery
How do I configure a computer in active directory to connect to the server?
Boot Repair Options in Vista Safe Mode
Cisco Unity Call Handlers
Transaction isolation levels