We want to replace the path on /etc/fstab file from
/dev/sdb /var/kafka ext4 defaults,noatime 0 0
To ( expected output )
/dev/sdb /var/kafka/hadoop_kafka ext4 defaults,noatime 0 0
The sed syntax that we are wrote is
sed s'/\/var\/kafka/\/var\/kafka\/hadoop_kafka/g' /etc/fstab
so once we run then we get in fstab this
/dev/sdb /var/kafka/hadoop_kafka ext4 defaults,noatime 0 0
But once we run again the sed then we get wrong path in fstab as:
/dev/sdb /var/kafka/hadoop_kafka/hadoop_kafka ext4 defaults,noatime 0 0
So how to replace the path , only in case we match the path:
/var/kafka