Баш-скрипт:
#!/bin/bash
# read combined.txt line by line
while read -r line; do
# skip missing file ${line}.xls
[ ! -f "$line".xls ] && continue
# echo line and one space character (without newline)
echo -n "$line " >> out
# get 5th column if line ends with "Yes" and optional whitespace at end of line
# replace newline '\n' with space ' '
sed -nE 's/^\S+\s+\S+\s+\S+\s+\S+\s+(\S+).*\sYes\s*$/\1/p' "$line".xls | tr '\n' ' ' >> out
# add newline
echo >> out
done < combined.txt
в одну строку:
while read -r line; do [ ! -f "$line".xls ] && continue; echo -n "$line " >> out; sed -nE 's/^\S+\s+\S+\s+\S+\s+\S+\s+(\S+).*\sYes\s*$/\1/p' "$line".xls | tr '\n' ' ' >> out; echo >> out; done < combined.txt
Обратите внимание, что каждая строка в out
будет иметь один дополнительный пробел в конце строки.
Я должен был добавить себя в группу audio
. Это был владелец группы/dev/snd/*