Я работаю над сценарием оболочки bash.У меня есть переменная, которая имеет ряд строк.Здесь: как извлечь каждую строку, которая соответствует символу 5 в столбце 5 ?
declare -a T1
echo '$input'
T=$(echo -e "$input" | grep 5)
echo "$T"
содержимое входной переменной:
:: find lo(): [5] :: Current Digital = 0.00 4
:: find lo(): [6] :: Current Digital = 0.00 4
:: find lo(): [7] :: Current Digital = 0.00 5
:: find lo(): [8] :: Current Digital = 0.00 4
:: find lo(): [5] :: Current Digital = 0.00 7
:: find lo(): [6] :: Current Digital = 0.00 7
:: find lo(): [7] :: Current Digital = 0.00 15
:: find lo(): [8] :: Current Digital = 0.00 7
:: find lo(): [5] :: Current Digital = 0.00 10
:: find lo(): [6] :: Current Digital = 0.00 10
:: find lo(): [7] :: Current Digital = 0.00 10
:: find lo(): [8] :: Current Digital = 0.00 35
:: find lo(): [5] :: Current Digital = 0.00 13
:: find lo(): [6] :: Current Digital = 0.00 25
:: find lo(): [7] :: Current Digital = 0.00 13
:: find lo(): [8] :: Current Digital = 0.00 13
:: find lo(): [5] :: Current Digital = 0.00 15
:: find lo(): [6] :: Current Digital = 0.00 50
:: find lo(): [7] :: Current Digital = 0.00 16
:: find lo(): [8] :: Current Digital = 0.00 55
Ожидаемое содержание переменной T1:
:: find lo(): [5] :: Current Digital = 0.00 4
:: find lo(): [5] :: Current Digital = 0.00 7
:: find lo(): [5] :: Current Digital = 0.00 10
:: find lo(): [5] :: Current Digital = 0.00 13
:: find lo(): [5] :: Current Digital = 0.00 15
Текущее содержание переменной T1:
:: find lo(): [5] :: Current Digital = 0.00 4
:: find lo(): [7] :: Current Digital = 0.00 5
:: find lo(): [5] :: Current Digital = 0.00 7
:: find lo(): [7] :: Current Digital = 0.00 15
:: find lo(): [5] :: Current Digital = 0.00 10
:: find lo(): [8] :: Current Digital = 0.00 35
:: find lo(): [5] :: Current Digital = 0.00 13
:: find lo(): [5] :: Current Digital = 0.00 15
:: find lo(): [6] :: Current Digital = 0.00 50
:: find lo(): [8] :: Current Digital = 0.00 55