I hope I phrased the question correct. I have a script that makes use of 'sed' a lot. It works great on my ubuntu with the GNU 'sed'. But when I try to run it on BusyBox it fails. Is there a way to get the GNU sed on busybox? I am not a Linux pro.
2 Answers
The Busybox iteself may have limited implementation of sed. You can copy the sed binary to some location and invoke it directly pointing it with a full path.
You may fix some incompatibility issues with replacing escapes that BusyBox builtin sed does not support, e.g. replacing the \s escape with [[:space:]] will solve the space-matching issue.
- 2,768
You seem to misunderstand how busybox works. The tool is one single executable that acts in different ways depending on the name (or subcommand) with which it is called. If you call a symlink sed pointing to the busybox binary (or busybox sed), the "sed" functionality will be executed.
To get GNU sed into a busybox environment, you have to remove the sed symlink to busybox and provide a GNU sed binary and the libraries it depends on. You can identify the libraries with the ldd command:
$ ldd /bin/sed
linux-gate.so.1 => (0xb7f78000)
libselinux.so.1 => /lib/libselinux.so.1 (0xb7f56000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7e0f000)
libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7e0a000)
/lib/ld-linux.so.2 (0xb7f79000)
- 5,570