循环通过逗号分隔的Python-Format列表
我有带有可变存储值的bash脚本,以python list格式:
business_unit = [“ a”,“ b”,“ c,d”,“ e f”]
,
并且需要循环要获得:
A
B
C,D
E F
脚本应将逗号,空格和任何特殊字符保留在双引号中。我已经尝试使用sed,ifs,但是它也在弦乐中分配逗号的线。
I have bash script with a variable storing values in sort of a python-list format :
Business_Unit=["A","B","C,D","E F"]
and need to loop over to get:
A
B
C,D
E F
The script should keep the commas, spaces and any special characters within the double quotes. I've tried using sed, IFS but it was splitting the line for commas within a string too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SED为我做到了:
Sed does it for me: