【发布时间】:2014-09-05 13:00:33
【问题描述】:
我正在尝试在 AIX 上执行此命令:
sed 's/\([a-Z]*\),.*/\1/' config >config.new
其中 config 是具有以下格式的文件:
item1,file1
item2,file2
但我总是收到以下错误:
sed: 0602-404 Function s/\([a-Z]*\),.*/\1/ cannot be parsed.
我怀疑正则表达式有问题,但它在 SUN 平台上运行良好。
【问题讨论】:
-
这会产生任何输出吗?
sed 's/\([a-Z]*\),.*/\1/' config -
也许能逃脱
/... -
不,它没有。它只是给出了那个错误。
-
不,这也无济于事。
-
我不太喜欢你的 [a-Z],请尝试替换为 [a-zA-Z] 或 [[:alpha:]] 看看是否有效。也许这就是你的麻烦的来源......