So I know that in order to replace something with the current date it would be
sed "s/something/`date +"%m-%d-%Y"`/" file.txt This would give me the date in mm-dd-YYYY But I want to be able the get the date in mm/dd/YYYY
'/' has by default a special meaning for sed, so you need to either escape the '/' like this:
sed "s/something/`date +"%m\/%d\/%Y"`/" file.txt or use another separator for sed, like this and there is no need to escape the '/':
sed "s|something|`date +"%m/%d/%Y"`|" file.txt $( ... ) construct instead of backticks.
m/d/yas you have in the question title? Shouldn't that bemm/dd/yy? Or perhapsmm/dd/yyyy? Please edit your question and add an example showing a specific date.