I have a list of parameters:
dwm.normfgcolor:
dwm.normbgcolor:
dwm.normbordercolor:
dwm.selfgcolor:
dwm.selbgcolor:
dwm.selbordercolor:
and a list of hex values:
#e6e4e3
#352231
#a19f9e
#e6e4e3
#FEE798
#e6e4e3
What i want to do is 'merge' them in a way that the first line in the first string corresponds to the first line in the second string and so forth. It should look like that
dwm.normfgcolor: #e6e4e3
dwm.normbgcolor: #352231
I thought of using
cat > output.txt<< EOF
dwm.normfgcolor: $variables?
dwm.normbgcolor:
dwm.normbordercolor:
dwm.selfgcolor:
dwm.selbgcolor:
dwm.selbordercolor:
EOF
with variables but I have no idea how.
CodePudding user response:
Answer - used paste -d with process substitution.
CodePudding user response:
Using paste
paste -d " " file1 file2
paste -d " " <(command to get input1) <(command to get input2)
paste -d " " file1 <(command to get output2)
Using awk
awk 'NR==FNR{a[FNR]=$0;next}{print a[FNR],$0}' file1 file2
awk 'NR==FNR{a[FNR]=$0;next}{print a[FNR],$0}' <(command1) <(command2)
awk 'NR==FNR{a[FNR]=$0;next}{print a[FNR],$0}' file1 <(command2)