There are many languages ??and tools that can achieve this function through regular expressions, but I only know sed for your reference. sed?'s/\(\[[0-9]\+\]\)\+/\1/'?file
#?\(?\)? means grouping and later Use ?\1? to reference this group, which is called capture or backreference in regular expressions
#?\[?\]?Since [?]? is a special character in regular expressions, if it is used in its original meaning, it needs to be used ?\? to escape.
#?[0-9]? represents any number from ?0-9?, which is equal to the regular ?\d? metacharacter.
However, ?sed? does not support ?\d
#?\+ means that the previous character is repeated one or more times. sed? uses ?+? and needs to be escaped with ?\?
#?s///? is the replacement format of ?sed?, which means to replace the previous matching content with the following ?\1
#?The above command can replace ?[digit A][digit A]...?replace with ?[number A]