A
A
AirFlare2021-03-29 20:42:22
cmd/bat
AirFlare, 2021-03-29 20:42:22

How to get the content from a file and also get the content from a line in a file?

There is a command to unpack the archive, its name is formed like this (in Linux):

unzip way/archive_`cat "$GK" |grep it.version.dev |awk -F '=' {'print $2'}`_`cat "$GK" |grep who.is.cat._or_codename |awk -F '=' {'print $2'}`.zip -d /way/to/folder

Required line:
`cat "$GK" |grep it.version.dev |awk -F '=' {'print $2'}`_`cat "$GK" |grep who.is.cat |awk -F '=' {'print $2'}`

The lines themselves look like this:
it.version.dev=yes
who.is.cat=5.1.2

How can it be rewritten for .bat?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wisgest, 2021-03-29
@AirFlare

for /f %%L in ('findstr "^it\.version\.dev= ^who\.is\.cat=" X.txt') do  set "%%L"
unzip way\archive_%it.version.dev%_%who.is.cat%.zip -d \way\to\folder

- the utility is used (although, if desired, it would be possible to get by with only internal CMD commands): lines starting with and findstrare searched in the X.txt file and are used in the command (more precisely, part of the line before the first space or tab character, if they are in the found line , but this, if necessary, is easy to change): the part of the line before becomes the name of the environment variable, and the part after becomes its value. it.version.dev=who.is.cat=set=

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question