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: 
Assuming your input is sorted:

```
$ awk 'p!=$1{if(NR>1) print r;p=r=$1}
{r=(r OFS $2)} END{print r}' file
1 abc def ghi
2 abc
3 abc def

```

* For each line;
	1. If its first column is equal to `p` (i.e first column of previous line);
		1. If line number (`NR`) is bigger than 1; print `r`.
		2. Populate `p` and `r` with first column's value.
	2. Add a space (`OFS`) and second column's value to `r`.
* At the end of the file, print `r`.
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

```