重複の可能性:
BusyBox 1.0でテキストを再帰的にgrepする方法は?
find
BusyBox 1.0で文字列を使用できない場合は、grep
ファイルから文字列を再帰的に取得する方法は?
iptables
(ルーターにTelnetで接続して、ルールが保存されている場所を見つけたいと思います。)
BusyBox v1.00 (2011.01.13-12:30+0000) シェル内蔵(msh) 組み込みコマンドのリストを表示するには、「help」と入力します。 #助ける 組み込みコマンド: ------ 。 :break cd 継続 eval exec 終了 終了 ヘルプ newgrp ログイン 読み取り読み取り専用シフトタイムトラップ設定umask待機[busybox cat chmod cp date dmesg echo expr false ftpget ftpput ホスト名 ifconfig init insmod Kill Killall klogd linuxrc ln logger logread ls mkdir mknod マウント msh mv ping ps pwd restart renice rm rmmod path sed sendarp sh sysinfo syslogdテストtftpトップトレースパスtrue tty vconfig wgetの削除
ベストアンサー1
現在のディレクトリで再帰パターン検索を実行するこのスクリプトを実行しました。 busyboxsh
とsed
1.17.1を使用してテストされました。
#!/bin/busybox sh
sed="busybox sed"
search_in()
{
searchterm="$1"
searchdir="$2"
prefix="$3"
(
cd "$searchdir"
for file in *
do
if [ -d "$file" ]
then
# recurse into subdirectory
search_in "$searchterm" "$file" "$prefix\\/$file"
else
# use sed like grep
$sed -rn '/'"$searchterm"'/s/(.*)/'"$prefix\\/$file"': \1/gp' "$file"
fi
done
)
}
# search for command-line search term, starting in current directory (`.`)
search_in "$1" . "."