Skip to content

sed

sed

Replace SSHd port with regexp

sed -i 's/^Port .*/Port 77/g' /etc/ssh/sshd_config

Use matched pattern

echo "foobarbaz" | sed 's/^foo\(.*\)baz$/\1/'

Returns bar.