这就是我想要做的:
$variable = `grep -i "Text: Added to directory" '$FOO/result.txt' | awk '{print $6}' | tr -d "'"`
print $variable;
输出:
Text: Added to directory /path/to/directory/
Use of uninitialized value $6 in concatenation (.) or string
我怎样才能只获取“/path/to/directory”而不是“文本:添加到目录/path/to/directory/”?