gpt4 book ai didi

regex - sed 命令在 solaris 中有效,但在 Linux 中无效

转载 作者:IT王子 更新时间:2023-10-29 01:00:34 24 4
gpt4 key购买 nike

我是 shell 脚本和 sed 命令的新手。

以下 sed 命令在 Solaris 中有效,但在 Linux 中出错:

sed -n 's/^[a-zA-z0-9][a-zA-z0-9]*[ ][ ]*\([0-9][0-9]*\).*[/]dir1[/]subdir1\).*/\2:\1/p'

错误是:

sed: -e expression #1, char 79: Invalid range end

我不知道为什么会出现无效范围结束错误。

最佳答案

Linux Sed 似乎不喜欢您的A-z(两次)。无论如何,这真的没有意义。

使用[A-Z](大写Z)

关于regex - sed 命令在 solaris 中有效,但在 Linux 中无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31519953/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com