Bash 仅当unix脚本中的单引号不是撇号时才删除它
我想在句子中保留“如果它们被用作我将要使用的,它是等的。但是需要删除“wamp”,“etc”Bash 仅当unix脚本中的单引号不是撇号时才删除它,bash,unix,Bash,Unix,我想在句子中保留“如果它们被用作我将要使用的,它是等的。但是需要删除“wamp”,“etc” I'll say 'bash is great!' if I could do this 应该成为 I'll say bash is great! if I could do this. $perl-pe“s@(?:\s'|'\s)@@g“尝试转义”字符。通常在大多数语言和系统中,反斜杠\用于转义特殊字符 请尝试以下操作: 我要说的是回声 我会说 >我会说 我会说 >echo我会说“bash”很棒
I'll say 'bash is great!' if I could do this
应该成为
I'll say bash is great! if I could do this.
$perl-pe“s@(?:\s'|'\s)@@g“尝试转义”字符。通常在大多数语言和系统中,反斜杠\用于转义特殊字符
请尝试以下操作:
我要说的是回声
我会说
>我会说
我会说
>echo我会说“bash”很棒
我会说bash很棒
>echo我会说“bash很棒”
我会说bash很棒
使用纯和:
而IFS=read-r行;做
line=“${line/\'/}”
line=“${line/\'/}”
line=“${line/\',/,}”
回音“$line”
完成
什么是规格/条件???看起来太棘手了,我需要bash中的解决方案。这看起来像是一个家庭作业。您尝试了什么?我尝试了一些,但似乎没有任何效果:sed“s/^'/;s/'$/”$ perl -pe "s@(?:\s'|'\s)@ @g" <<< "I'll say 'bash is great' if I could do this"
I'll say bash is great if I could do this
while IFS= read -r line; do
line="${line//\' / }"
line="${line// \'/ }"
line="${line//\',/,}"
echo "$line"
done < YOUR_BIG_FILE.TXT