Input file:
$ cat file1
11
12
13
14
Output required: Print the combination of above lines so that output looks like:
11,12
11,13
11,14
12,11
12,13
12,14
13,11
13,12
13,14
14,11
14,12
14,13
Awk solution:
$ awk '
{ a[$0] }
END {
for (i in a){
for (j in a){
if (i != j) print (i "," j)
}
}
}' file1
.
No comments:
Post a Comment