Grep命令提取唯一的单词

boo*_*shq 3 linux grep

这是我的档案.

this is temp1
this is temp2
this is temp3
this is temp1
this is tempabc
Run Code Online (Sandbox Code Playgroud)

如何使用grep命令,虽然寻找模式"温度",其结果应显示为唯一的"temp1中,TEMP2,TEMP3,tempabc",只有唯一码字.

谢谢

Chr*_*our 7

仅显示以temp下列开头的唯一单词:

$ grep -o '\btemp\w*' file | sort -u
temp1
temp2
temp3
tempabc
Run Code Online (Sandbox Code Playgroud)