====== SED - Change - Change from Nth occurrence in a line ====== Use the combination of /1, /2 etc and /g to replace all the patterns from the Nth occurrence of a pattern in a line. The following sed command replaces the third, fourth, fifth… “unix” word with “linux” word in a line. sed 's/unix/linux/3g' filename