我有以下文字
Shell 脚本是为操作系统的“shell”或命令行解释器编写的(脚本)。shell [通常] 被认为是一种“简单”的领域特定编程语言。
我只需要使用脚本打印双引号括起来的字符串吗?
谢谢!
答案1
只要引用的字符串不跨行并且不包含引用或转义的引号:
$ perl -ne 'print "$1\n" while m!"([^"]+)"!g' maxwell.txt
the shell
simple
$ cat maxwell.txt
i have the following text
A shell script is a (script) written for "the shell", or command line interprete
r, of an operating system. The shell is [often] considered a "simple" domain-spe
cific programming language.
i need to print the strings surrounded by double quotes only using script?
Thanks!
$