====== change firewall rule. ====== uci set firewall.@rule[xxx].enabled=1 uci commit firewall service firewall restart rulenum=$(uci show firewall | grep 'Your Rule Name' | sed 's/.*@//;s/.name.*//') uci set firewall.@"$rulenum".enabled="1" Let’s break down the sed command: sed: This stands for stream editor. It’s a powerful utility for text manipulation in Unix-like operating systems. 's/.*@//;s/.name.*//': The s command in sed is used for substitution. The pattern inside the first pair of slashes (/.*@//) matches any sequence of characters (.*) followed by an @ symbol. It replaces this entire matched sequence with nothing (i.e., deletes it). The semicolon (;) separates multiple sed commands. The second pattern (s/.name.*//) matches any sequence of characters (.*) that contains the substring .name. Again, it replaces this matched sequence with nothing. Overall Explanation: The sed command takes input text and applies these two substitution patterns sequentially. It removes any part of the input line that matches the specified patterns. In the context of our previous example, it’s used to extract the rule number from the output of uci show firewall. Remember that sed is a powerful tool for text manipulation, and its syntax can be quite concise. In this case, it’s used to extract relevant information from the output of another command. 😊