Can some explain me what the following does?
find $FIRMWARE_BASE_DIR \( -name "*.txt" \) -type f |
xargs -t -n1 sed -i '' -e '/^#/d;/^nocrc=/d;/macaddr=/d;/^$/d;s/[ \t]*$//'
Can some explain me what the following does?
find $FIRMWARE_BASE_DIR \( -name "*.txt" \) -type f |
xargs -t -n1 sed -i '' -e '/^#/d;/^nocrc=/d;/macaddr=/d;/^$/d;s/[ \t]*$//'
This bit:
find $FIRMWARE_BASE_DIR \( -name "*.txt" \) -type f
finds all regular files ending with .txt
under the directory stored in the FIRMWARE_BASE_DIR environment variable.
Note that the parenthesis are escaped so that they are passed to find instead of being interpreted by the shell but there is only one find predicate inside them so they have no function - if this command is machine generated perhaps it may contain more than one term sometimes? If not then they could be removed.
You can find the documentation at http://man7.org/linux/man-pages/man1/find.1.html
This bit:
xargs -t -n1 command
takes that list of files and runs whatever command is specified on each filename (printing the command to the screen beforehand)
You can find the documentation at http://man7.org/linux/man-pages/man1/xargs.1.html
This bit:
sed -i '' -e '/^#/d;/^nocrc=/d;/macaddr=/d;/^$/d;s/[ \t]*$//'
edits the input file in place without a backup:
#
or nocrc=
macaddr=
You can find the documentation at http://man7.org/linux/man-pages/man1/sed.1.html