• Zach Pfeffer

Find "eth0" in all "*.dt*" files


Post Description

This posts gives a fast and a slow way to find eth0 in all "*.dt*" files under the current directory. You may use this to find the string "eth0" in device tree files.

Fastreal 0m0.139s user 0m0.067s sys 0m0.075s

Slow

real 0m2.432s user 0m1.816s sys 0m0.639s

Command Line Options Explained

grep

-H

Print the file name for each match. This is the default when there is more than one file to search.

--ignore-case

Ignore case distinctions, so that characters that differ only in case match each other. Although this is straightforward when letters differ in case only via lowercase-uppercase pairs, the behavior is unspecified in other situations. For example, uppercase “S” has an unusual lowercase counterpart “ſ” (Unicode character U+017F, LATIN SMALL LETTER LONG S) in many locales, and it is unspecified whether this unusual character matches “S” or “s” even though uppercasing it yields “S”. Another example: the lowercase German letter “ß” (U+00DF, LATIN SMALL LETTER SHARP S) is normally capitalized as the two-character string “SS” but it does not match “SS”, and it might not match the uppercase letter “ẞ” (U+1E9E, LATIN CAPITAL LETTER SHARP S) even though lowercasing the latter yields the former.

-y is an obsolete synonym that is provided for compatibility. (-i is specified by POSIX.)

find

xargs

--null

Input file names are terminated by a null character instead of by whitespace, and any quotes and backslash characters are not considered special (every character is taken literally). Disables the end of file string, which is treated like any other argument.

find

-print0

Print the entire file name on the standard output, followed by a null character.

Good Google search to find command line options:

"site:gnu.org grep"

Machine MHz

Reference

Tux from link (found via Google image search).

Our Recent Posts

Tags

SEARCH THIS SITE

©2020 by Zach Pfeffer