I am trying to run the following script.
#!/bin/bash
while read data; do
echo $data;
sed -n -e '/$data/,/reason/ p' logfile >> output-$data.txt
done <hosts
The script runs well, without errors, but for some reason I don't know why the sed command doesn't work as it should be. The output files are all empty.