我有以下文字
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!
$