В общем на линуховой машине выполняется как надо, а во FreeBSD не пашет.
Код: Выделить всё
[localhost@telteron] ~/> echo a111b | sed -ne '/a1\+b/p'
a111b
[localhost@telteron] ~/>
Может кто сталкивался? Скажите в какую сторону копать
Модератор: terminus
Код: Выделить всё
[localhost@telteron] ~/> echo a111b | sed -ne '/a1\+b/p'
a111b
[localhost@telteron] ~/>
Код: Выделить всё
a111b | sed -nEe '/a1+b/p'из man sed
-E
Interpret regular expressions as extended (modern) regular
expressions rather than basic regular expressions (BRE's). The
re_format(7) manual page fully describes both formats.
Код: Выделить всё
#cat /proc/98473/cmdline | sed -nEe 's/\000/ /g' | cut -d" " -f2
Код: Выделить всё
#cat /proc/98473/cmdline | xargs -0 | cut -d" " -f2
Позволяетbarut писал(а):А использовать xargs -0 религия не позволяет?
Код: Выделить всё
#cat /proc/98473/cmdline | xargs -0 | cut -d" " -f2
Код: Выделить всё
~> perl -e 'print 5; print chr 0; print 3; print "\n"' | od -c
0000000 5 \0 3 \nКод: Выделить всё
~> perl -e 'print 5; print chr 0; print 3; print "\n"' | perl -pe 's/\0/F/' | od -c
0000000 5 F 3 \n
~> perl -e 'print 5; print chr 0; print 3; print "\n"' | tr '\0' 'U' | od -c
0000000 5 U 3 \nКод: Выделить всё
~> perl -e 'print 5; print chr 0; print 3; print "\n"' | gsed -r 's/\x00/X/g' | od -c
0000000 5 X 3 \ntelteron писал(а):Спасибо всем за ответы. Просто хотел универсальности, поэтому заморочился с этим sed. Ну т.е. без всяких сторонних обработчиков (perl, ruby, php) хотелось написать то, что будет стопудово работать на любой системе. Видимо не тот случай.
Код: Выделить всё
#cat /proc/98473/cmdline | sed -nEe 's/\000/ /g' | cut -d" " -f2Код: Выделить всё
#cat /proc/98473/cmdline | tr '\0' ' ' | cut -d" " -f2