在Android busybox中使用cut或sed

在Android busybox中使用cut或sed,android,adb,cut,busybox,Android,Adb,Cut,Busybox,我想修剪一根绳子。 如果我编写busybox--help,它会将cut和sed列为可用命令 mount |grep -e /system 有效,但是 mount |grep -e /system| cut -f 1 -d ' ' 不起作用。android的busybox中有特殊语法吗? 我也试过了 echo "Hello World"|cut -f 1 -d ' ' 从主页上看,它不起作用 root@android:/ # busybox cut --help busybox cut

我想修剪一根绳子。 如果我编写busybox--help,它会将cut和sed列为可用命令

mount |grep -e /system
有效,但是

 mount |grep -e /system| cut -f 1 -d ' '
不起作用。android的busybox中有特殊语法吗? 我也试过了

 echo "Hello World"|cut -f 1 -d ' '
从主页上看,它不起作用

root@android:/ # busybox cut --help
busybox cut --help
BusyBox v1.21.1-Stericson (2013-07-08 15:58:11 BST) multi-call binary.

Usage: cut [OPTIONS] [FILE]...

Print selected fields from each input FILE to stdout

    -b LIST Output only bytes from LIST
    -c LIST Output only characters from LIST
    -d CHAR Use CHAR instead of tab as the field delimiter
    -s      Output only the lines containing delimiter
    -f N    Print only these fields
    -n      Ignored

要使
busybox
小程序按您期望的方式工作,您需要首先创建适当的符号链接:

$ adb shell whence sed
$ adb shell sed
/system/bin/sh: sed: not found
$ adb root
$ adb remount
remount succeeded
$ adb shell whence busybox
/system/bin/busybox
$ adb shell ln -s /system/bin/busybox /system/bin/sed
$ adb shell whence sed
/system/bin/sed
$ adb shell sed
Usage: sed [-efinr] SED_CMD [FILE]...

或者只需执行
mount | grep-e/system | busybox cut-f 1-d'

即可让
busybox
小程序按照您希望的方式工作,您需要先创建适当的符号链接:

$ adb shell whence sed
$ adb shell sed
/system/bin/sh: sed: not found
$ adb root
$ adb remount
remount succeeded
$ adb shell whence busybox
/system/bin/busybox
$ adb shell ln -s /system/bin/busybox /system/bin/sed
$ adb shell whence sed
/system/bin/sed
$ adb shell sed
Usage: sed [-efinr] SED_CMD [FILE]...

或者只需执行
mount | grep-e/system | busybox cut-f 1-d'

首先检查可用选项
cut--help
为问题添加了可用选项。只需将busybox添加到行中,它就可以工作了。这与
cut--help
不起作用是一样的,但是
busybox-cut--help
起作用
mount | grep-e/system | busybox cut-f 1-d'
可能从
cut
到busybox没有符号链接,或者可能某个更原始的版本首先出现在您的搜索路径中。首先检查可用选项
cut--help
为问题添加了可用选项。只需将busybox添加到行中,它就可以工作了。这与
cut--help
不起作用是一样的,但是
busybox-cut--help
起作用
mount | grep-e/system | busybox cut-f 1-d'
可能没有从
cut
到busybox的符号链接,或者某个更原始的版本首先出现在您的搜索路径中。是的,正如我在评论中所说,它可以工作,错误确实是缺少符号链接。我没有意识到,当我键入“sed”或“cut”时没有错误,它找到了命令并给了我参数列表。但我仍然必须使用busybox命令,而不是别名。谢谢你的帮助!是的,正如我在我的评论中所说的,这个错误确实是缺少符号链接。我没有意识到,当我键入“sed”或“cut”时没有错误,它找到了命令并给了我参数列表。但我仍然必须使用busybox命令,而不是别名。谢谢你的帮助!