如何用一个有效的命令在OpenWrt上安装所有iptables相关的软件包?

发布于 2024-12-22 11:05:29 字数 1913 浏览 6 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤君无依 2024-12-29 11:05:30

您可以用以下 grep 命令完全替换 grep 命令:

grep -E "Package: ((iptables-mod-|kmod-(ipt-|nf))|.*(nfnetlink|netfilter|iptables))" /var/opkg-lists/packages

-E 选项指定 grep 使用扩展正则表达式。我正在使用的扩展正则表达式的特点是:

(c|b)at 

它匹配“cat”或“bat”,即仅选择圆括号中的选项之一。因此,在您的情况下, grep 命令将匹配

  • Package: iptables-mod-
  • Package: kmod-ipt-
  • Package: kmod-nf
  • Package: .*nfnetlink
  • Package: .*netfilter
  • Package: .*iptables

要更好地了解正则表达式,请使用http://www.grymoire.com/Unix/Regular.html作为参考。正则表达式构成了 grep、sed、awk、find 和许多其他 UNIX 命令的基础。因此,如果您很好地掌握了正则表达式,那将是一个很大的优势。享受!

You can replace the grep command entirely by this grep command:

grep -E "Package: ((iptables-mod-|kmod-(ipt-|nf))|.*(nfnetlink|netfilter|iptables))" /var/opkg-lists/packages

The -E option specifies grep to use extended regular expressions. The feature of extended regular expressions I am using is:

(c|b)at 

This matches "cat" or "bat" i.e. only one of the options in the round brackets are chosen. So in your case the grep command will match

  • Package: iptables-mod-
  • Package: kmod-ipt-
  • Package: kmod-nf
  • Package: .*nfnetlink
  • Package: .*netfilter
  • Package: .*iptables

To gain better knowledge of regular expressions please use http://www.grymoire.com/Unix/Regular.html as a reference. Regular expressions form the basis of grep, sed, awk, find and many other UNIX commands. So it is a big advantage if you have a good grasp of regular expressions. Enjoy!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文