Strip Current Date with SED

view full story

http://forums.fedoraforum.org – Hi All, I have a quick question with regards to SED syntax, and I hope someone here can help me out. I have some text based reports in which I would like to strip the "Current Date" from and replace with equivalent number of empty spaces, for every occurrence. For example, here is what I need to strip: Date: 11/09/09 If I manually run the following SED command, it works great, however I cannot seem to find a way to use the actual "date" command within SED, to get the desired results. WORKING: sed -i -e 's/Date\: 11\/09\/09/ /' myfile I've been messing around with various attempts to do this using the "date" command within SED, but I just can seem to get it right. I've also attempted defining variables which call separate "date" commands for day, month, year and inject them via standard variable calling, echoing variable, expanding variable with brackets, etc... There must be something small I'm missing, and it's starting to drive me nuts... Here are a few of the SED command attempts I've tried: Quote: sed -i -e 's:Date\: `date +%D`: :' myfile sed -i -e "s/Date\: `date +%d`\/`date +%m`\/`date +%y`/ /" myfile sed -i -e 's/Date\: `date +%d`\/`date +%m`\/`date +%y`/ /' myfile sed -i -e 's/Date\: $(date +%D) / /' myfile *** I need to replace it with the equivalent number of spaces, as I'm going to be overlaying a PCL Logo here and need to keep the structure of the rest of the file. Cannot have the remaining portion of the line shifting left. Any help is appreciated. Thanks in Advance (HowTos)