Skip to main content
1 of 2
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k

Use the t command after each s command to branch to the end of the script if a substitution was made:

sed -e 's/something/else/;t' \ -e 's/one/two/;t' \ -e 's/two/three/;t' <<<"one" 
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k