I need to replace the whole line with sed if it matches a pattern. For example if the line is \'one two six three four\' and if \'six\' is there, then the whole
sed
Above answers worked fine for me, just mentioning an alternate way
Match single pattern and replace with a new one:
sed -i '/six/c fault' file
Match multiple pattern and replace with a new one(concatenating commands):
sed -i -e '/one/c fault' -e '/six/c fault' file