使用 grep (或任何东西)查找以符号开头的关键字,然后输出逗号分隔的
我正在尝试将一堆数据从一个网络服务迁移到另一个网络服务,在此过程中我想确保我做得正确,这样我就不会担心某些不正确或不合适的事情。
我想做的事情之一是在单个文件中查找以磅符号开头的单词,然后提取紧随其后的单词,然后将它们以逗号分隔打印回来。
例如,在文件中的某些点上会有“#word - #word2 : #word3” - 它们之间有完全随机的内容,请注意, - 然后我希望能够将其踢掉aswords
='word,word2,word3'
抛弃英镑符号和周围的任何其他乱码。
除了基本的脚本编写之外,我对任何事情都毫无用处。任何帮助将不胜感激。
I'm attempting to migrate a bunch of my data from one webservice to another, and in the process I want to make sure I do it right so I won't be obsessing about something not being right or out of place.
One of the things I want to do is find words lead by a poundsign within a single file, then extract the word immediately following them, and then print them back comma-separated.
So for example, at some points in the file there'll be "#word - #word2 : #word3" - with completely random stuff between them, mind you, - And then I'd like to be able to kick that back out as
words='word,word2,word3'
ditching the poundsign and any other gibberish around them.
I'm completely useless at anything beyond basic scripting. Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试:
You can try: