I want to set an IP as variable ($a) then subtract -1 from last sector and echo the output in a sentence into a .txt file.
Below is what I had in mind but doesn't quite work.
a=123.123.123.123
echo $a | awk -F"." '{printf "%d.%d.%d.%d", $1, $2, $3, $4 - 2}' > $i
echo -e "stream = http://"$i"/control/faststream.jpg?stream=full&needlength&fps=16.0 \n" | cat - note1.txt > temp && mv temp note1.txt
Also, I don't really care about displaying this output
echo $a | awk -F"." '{printf "%d.%d.%d.%d", $1, $2, $3, $4 - 2}' > $i
I just want it to be used in the next command.
Thanks in advance.