What can be used in command line to replace a line starting with "something" in a text file.
I have a text file that looks something like this:
118 => some text …
120 => some text …
121 => some text …
130 => some text …
What I’m trying to do is to replace a line starting with lets say “120” with different text for example “120 => some other text”. Is there an easy way to do this, perhaps with sed, and what would the command look like.
sed "s/^120 =>.*/120 => some other text/" file >newfile
The ^ means start of line