Thursday, March 28, 2013

sed command to replace first occurrence of a pattern in file

sed command to replace first occurrence of a pattern in file : 


sed '0,/pattern/s/pattern/replacement/' filename

That's simple and sweet!

No comments:

Post a Comment