Comentando linha existente em um arquivo e adicionando 3 novas linhas abaixo da linha comentada no shell ksh

1

O arquivo de configuração tem a linha abaixo:

Ciphers aes128-ctr,aes192-ctr,aes256-ctr

Portanto, é necessário comentar esta linha e adicionar linhas abaixo após a linha comentada.

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour
PubkeyAcceptedKeyTypes [email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa,ssh-dss
HostKeyAlgorithms [email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ssh-ed25519,ssh-rsa,ssh-dss

A saída deve estar no formato abaixo.

#Ciphers aes128-ctr,aes192-ctr,aes256-ctr
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour
PubkeyAcceptedKeyTypes [email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa,ssh-dss
HostKeyAlgorithms [email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ssh-ed25519,ssh-rsa,ssh-dss
    
por ikram 07.08.2018 / 12:17

1 resposta

1

Tente

sed '/Ciphers aes128-ctr,aes192-ctr,aes256-ctr/ {s/^/#/; a\
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128cbc,3des-cbc,blowfish-cbc,cast128- . . . 
}' file
    
por 07.08.2018 / 12:44

Tags