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.
我有这样的文本文件:
word1 & wordff 39 0: sgfdgggg, sgdgsd word23 & sgfdgsdgsdgdg 44 0: sgdggfg, sfgdgdg word45 *
我需要这个:
word1 & word23 & word45 *
我怎样才能在 GREP 中做到这一点?
grep -Eo '.*?[&*#]'
例如:
kent$ echo "word1 & wordff 39 0: sgfdgggg, sgdgsd word23 & sgfdgsdgsdgdg 44 0: sgdggfg, sfgdgdg word45 *"|grep -Eo '.*?[&*#]' word1 & word23 & word45 *