tente:
awk '{print $1, $2}' OFS=, infile
aa.com,1.21.3.4,string1,string2
bb.com,5.6.7.8,string1,string2
Se, nesse caso, você tivesse espaços em branco no primeiro ou no segundo campo, você faria:
awk -F, '{ match($3, /[^ ]* +[^ ]*/);
bkup=substr($3, RSTART, RLENGTH);
gsub(/ +/, ",", bkup); # replace spaces with comma
print $1, $2, bkup
}' OFS=, infile
Explicação: leia em homem awk
:
match(s, r [, a])
Return the position in s where the regular expression r occurs,
or 0 if r is not present, and set the values of RSTART and RLENGTH. (...)
substr(s, i [, n])
Return the at most n-character substring of s starting at I.
If n is omitted, use the rest of s.
RSTART
The index of the first character matched by match(); 0 if no
match. (This implies that character indices start at one.)
RLENGTH
The length of the string matched by match(); -1 if no match.