i'm trying to insert variable in a file with sed
I have variable $time and i want insert it in index.html file in specific string(line number 53):
the time: <span id="$time"></span>
i'm trying to insert variable in a file with sed
I have variable $time and i want insert it in index.html file in specific string(line number 53):
the time: <span id="$time"></span>
If you want to edit your file in place, with a GNU sed, you can:
sed -i s/'$time'/$(date +%H:%M:%S)/ index.html
the trick here is correctly quoting. Notice that this will change the first $time in every line of your document with the time; you can limit to a specific line (say 53) with 
sed -i 53s/'$time'/$(date +%H:%M:%S)/ index.html
$IFS and filename generation - both of which can/will generate multiple fields. Combined with a / separator and the -i option it's... well, it's not correctly quoted.
                
                alias date=whatever before.... but yes, strictly, you are right.