I will like to unzip several files and merge it as ONE variable in bash.
For example: There are several text files.
one=text1.gz
two=text2.gz
three=text3.gz
I would like to merge them to become a variable
variable=(zcat $one $two $three)
So
$variable=($one)+($two)+($three)
How can I achieve this?
You bash syntax isn't correct.
To assign a variable the result of the command, you need to use
$(...)
:Depending on what you want to do with the content of these files, this might not be the best way forward.
You might want concatenate the files into another one using redirection:
then work with the
combine_file
.Or directly process command further using pipe
|
:where
my_command
could besed
,awk
, etc...