-i может использоваться только с sed, если вы передаете файл, это означает «inline replace». Без этого вывод sed будет записан на stdout (обычно на консольном выходе). С помощью -i он выполняет встроенную замену, то есть выполняет замены в самом файле.
Следующий код считывает содержимое jasperreports.properties в переменную $input (строка 1) и находит строка, подлежащую замене (строка 2). В третьей строке он выводит входную строку и передает ее через sed для замены. sed выводит строку на stdout, которая будет обнаружена $( и ) и поэтому будет сохранена в $input.
read input < jasperreports.properties
find=$(grep "$jasper" jasperreports.properties | awk -F"reports/" '{print $2}')
input=$(echo "$input" | sed "s/$find/charts/")
Если вы хотите немедленно применить изменения к файлу:
find=$(grep "$jasper" jasperreports.properties | awk -F"reports/" '{print $2}')
sed "s/$find/charts/" -i jasperreports.properties
Из man sed:
s/regexp/replacement/
Attempt to match regexp against the pattern space. If
successful, replace that portion matched with replacement. The
replacement may contain the special character & to refer to that
portion of the pattern space which matched, and the special
escapes \1 through \9 to refer to the corresponding matching
sub-expressions in the regexp.