# Be confused with cut



## goldenfire (Jan 7, 2010)

```
Freebsd1# echo "aaa.bbb" | cut -d'.' -f1,2
aaa.bbb
```

I think  the result should be aaabbb.
Why there is still a '.'?
I am confused.
Could anyone help


----------



## crsd (Jan 7, 2010)

cut(1):
	
	



```
-f list
             The list specifies fields, separated in the input by the field
             delimiter character (see the -d option).  Output fields are [b]sepaâ€
             rated by a single occurrence of the field delimiter character[/b].
```


----------



## goldenfire (Jan 7, 2010)

Thanks a lot!
Does that mean I should use "awk" instead of "cut"?


----------



## fronclynne (Jan 7, 2010)

It would appear in practice that cut(1) leaves the delimiter in the output.  The example from the manpage ([cmd=c:\>] cut -d : -f 1,7 /etc/passwd[/cmd] leaves the ":").  As to what you _should_ use, I don't know.  sed(1)?


----------



## crsd (Jan 7, 2010)

It depends on what you are trying to achieve. If you just need to delete '.', try using tr(1)


----------



## sixtydoses (Jan 7, 2010)

`echo "aaa.bbb" | sed -e 's/\.//'`


----------



## lyuts (Jan 7, 2010)

Or you can use 'tr' for that.
[CMD="> "]echo "aaa.bbb" | tr -d "."[/CMD]


----------

