Hi,
I have two files say file 1 file 2
File1
1
2
4
5
File 2
asdf
adf
How to get the ouput something like
asdf1
adf1
asdf2
adf2
asdf4
adf4
asdf5
adf5
Please give your comments
Hi,
I have two files say file 1 file 2
File1
1
2
4
5
File 2
asdf
adf
How to get the ouput something like
asdf1
adf1
asdf2
adf2
asdf4
adf4
asdf5
adf5
Please give your comments
one way:
# while read a; do nawk -v a=$a '{print $0a}' file2; done < file1
asdf1
adf1
asdf2
adf2
asdf4
adf4
asdf5
adf5
nawk 'FNR==NR{f2[FNR]=$0;next}{for(i=1;i in f2;i++) print f2 $0}' file2 file1
Hope this perl code will help
make sure you dont have any blank lines in the file1 and file2
use strict;
use warnings;
my @a = `cat file1 `;
my @b = `cat file2 `;
foreach my $c (@a )
{
foreach my $d (@b)
{
chomp $c ;
chomp $d ;
print "${d}${c}\n";
}
}
You can use the below code
for i in `cat file1`
do
for j in `cat file2`
do
echo "$j$i"
done
done
Thanks
while read i; do
while read j; do
echo "$j$i"
done < file2
done < file1