Как получить все совпадения из файла на основе имен в другом файле?

Проверьте в документации вашей системы, какие имена пользователей разрешены. Например.:

man useradd

На моем Debian 10 в разделе ПРЕДОСТЕРЕЖЕНИЯ я прочитал это:

It is usually recommended to only use usernames that begin with a lower case letter or an underscore, followed by lower case letters, digits, underscores, or dashes. They can end with a dollar sign. In regular expression terms: [a-z_][a-z0-9_-]*[$]?

On Debian, the only constraints are that usernames must neither start with a dash ('-') nor plus ('+') nor tilde ('~') nor contain a colon (':'), a comma (','), or a whitespace (space: ' ', end of line: '\n', tabulation: '\t', etc.). Note that using a slash ('/') may break the default algorithm for the definition of the user's home directory.

0
11.11.2020, 02:04
1 ответ

Вероятно, это то, что вам нужно:

awk 'NR==FNR{a[$1]; next} $2 in a' file2 file1
1
18.03.2021, 22:50

Теги

Похожие вопросы