Я хотел бы вставить строки в файл в bash, начиная с определенной строки.
Каждая строка представляет собой строку, которая является элементом массива
line[0]="foo"
line[1]="bar"
...
а конкретная строка - "поля"
file="$(cat $myfile)"
for p in $file; do
if [ "$p" = 'fields' ]
then insertlines() #<- here
fi
done