Невозможно записать cd в .ssh

Я не мог получить это в grep или sed, но Perl пришел на помощь:

$ perl -e 'while ($ stdin = <>) {@matches = $ stdin = ~ / (tech) [^ 0-9] * ([0-9x] [0-9x.] *) / Г; print "@matches \ n" if @matches} '

Обратите внимание, что предназначен только для ввода файла в сценарий через стандартный ввод; stdin может быть предоставлен из любого другого источника (например, каналов, перенаправления строки <<< ).

Объяснение:

# Assign standard input ( in Perl) to a variable to use it for matching 
# and to detect when the input is empty (i.e. EOF)
while ($stdin = ) { 
    # Assign the matches from $stdin to array @matches
    # /(tech)[^0-9]*([0-9x][0-9x.]*)/g;
    #    (tech): match the term 'tech', () puts it into @matches
    #    [^0-9]*: match any non-number to discard, since .* was too greedy 
    #             and matched up to the last number
    #    ([0-9x][0-9x.]*): match the pattern 0, 0.x, 0.9.x, etc., () puts it into @matches
    @matches = $stdin =~ /(tech)[^0-9]*([0-9x][0-9x.]*)/g;
    # Display the array from above if @matches is not empty
    print "@matches\n" if @matches
}

Когда это применяется к файлу, результат будет следующим:

tech 1.2
tech 1 
tech 0.1
tech 10.1.3
tech 7.5
tech 8.0
tech 1.3.x
tech 5.x
tech 2.0.4x
1
23.02.2017, 23:49
1 ответ

Чтобы войти в каталог, вы должны установить для него права на выполнение.

Это должно сработать:

chmod u + x .ssh /

9
27.01.2020, 23:13

Теги

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