Question: I'like to print all second field from rows in one row if their first field is identical. The amount of first identical filed are undefined 

Example

```
1 abc    
1 def    
1 ghi    
2 abc    
3 abc    
3 def

```

Desired output

```
1 abc def ghi    
2 abc    
3 abc def

```

Answer: 
Could you please try following, it will also provide you output in same form in which 1st field of Input\_file has come.

```
awk '
!a[$1]++{
  b[++count]=$1
}
{
  c[$1]=(c[$1]?c[$1] OFS $2:$2)
}
END{
  for(i=1;i<=count;i++){
    print b[i],c[b[i]]
  }
}'  Input_file

```
Another awk

```
$ cat michael.txt
1 abc
1 def
1 ghi
2 abc
3 abc
3 def
$ awk  ' { c=$1; if(p!=c && NR>1 ) { print p,b,a;b="" } if(p==c) { b=b " "a} p=c;a=$2 } END { print p,b,a } ' michael.txt
1  abc def ghi
2  abc
3  abc def

```