append text from file1 to the end of each line in file2

hi;

my file2.txt:

portname=1;list=10.11;l-
portname=2;list=10.12;l-
portname=3;list=10.13;l-
...

my file1.txt:

;"{'sector=%27'}"\&>

so; i want to see:

portname=1;list=10.11;l-;"{'sector=%27'}"\&>
portname=2;list=10.12;l-;"{'sector=%27'}"\&>
portname=3;list=10.13;l-;"{'sector=%27'}"\&>
...

how can i script it? :frowning:

awk 'NR==FNR{x=$0;next}{$0=$0""x}1' file1.txt file2.txt
1 Like
perl -lne 'if (!$f){$n=$_; $f=1}else{$_.=$n; print}  ' file1.txt  file2.txt
1 Like

thanks bartus11 :slight_smile:

awk 'NR==1{a=$0;next} {print $0 a}' file1.txt file2.txt
1 Like