I want to pass the output of a Sed command to a variable in batch.
For example, in the file “input.txt” I have name=kiddy bla bla.
I want to extract the the word kiddy and save it in a variable (say, name), so I can use it later (with %name%).
I want to pass the output of a Sed command to a variable in
Share
Sure, you can set a variable with the output of a
sedcommand with aforloop:Yes, it’s not so intuitive, but it works.
Also, you can change the command to anything you want, as long as it’s between
apostrophes (
').P.S
To extract the value
kiddyfromname="kiddy" bla bla, use suchsedsyntax: