Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在使用以下方法将文件拆分为单词-有更快的方法吗?
while read -r line do for word in $line do words="${words}\n${word}" done done
使用tr怎么样?
tr -s '[:space:]' '\n' < myfile.txt
将-s多个空白字符压缩为一个。
-s
xargs -n 1 echo <myfile.txt
sed 's/[[:space:]]/\n/g' file.txt