Skip to main content
added 469 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Similar to Stephen's answer, but slightly different in the way it's executed:

sed -i '/^RELEASESTATUS=/s/$/xyz/' keyvalue.txt

Instead of replacing the entire line with a copy of itself with some text added to the end, this first locates the correct line (the line that has RELEASESTATUS= at the very start) and then substitutes in the required text at the end of that line.

This uses the fact that the general form of the substitute command (s) in sed is

start,end s/pattern/replacement/flags

where start and end gives the range of lines that the command should be applied to, given as a start and end address (and "address" may be a line number or regular expression, or an offset). When using a single address, the command is applied to that line only (or to the single lines matching a particular regular expression).

Similar to Stephen's answer, but slightly different in the way it's executed:

sed -i '/^RELEASESTATUS=/s/$/xyz/' keyvalue.txt

Instead of replacing the entire line with a copy of itself with some text added to the end, this first locates the correct line (the line that has RELEASESTATUS= at the very start) and then substitutes in the required text at the end of that line.

Similar to Stephen's answer, but slightly different in the way it's executed:

sed -i '/^RELEASESTATUS=/s/$/xyz/' keyvalue.txt

Instead of replacing the entire line with a copy of itself with some text added to the end, this first locates the correct line (the line that has RELEASESTATUS= at the very start) and then substitutes in the required text at the end of that line.

This uses the fact that the general form of the substitute command (s) in sed is

start,end s/pattern/replacement/flags

where start and end gives the range of lines that the command should be applied to, given as a start and end address (and "address" may be a line number or regular expression, or an offset). When using a single address, the command is applied to that line only (or to the single lines matching a particular regular expression).

Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Similar to Stephen's answer, but slightly different in the way it's executed:

sed -i '/^RELEASESTATUS=/s/$/xyz/' keyvalue.txt

Instead of replacing the entire line with a copy of itself with some text added to the end, this first locates the correct line (the line that has RELEASESTATUS= at the very start) and then substitutes in the required text at the end of that line.