unix - shell script to display the calendar of the current month with current date replace by * -


i want result this:

may 2014 su mo tu th fr sa              1  2  3 4   5  *  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 

i able extract date using date |cut -d' ' -f4

but when execute command, cal|sed "s/date|cut -d' ' -f4/*/"

there no change calender output.

can 1 tell me going wrong??

thanks.

running data|cut -d' ' -f4 single script , using word boundary around selection select particular date.

cal|sed -r "s/\b$(date|cut -d' ' -f4)\b/*/" 

here putting $(date|cut -d' ' -f4) run script , output used in sed selection:

cal|sed -r "s/\boutput\b/*/" 

using \b important since indicates word boundary. else, current date (say 5), occurrence of 5 replaced *.

output:

     july 2015         su mo tu th fr sa             1  2  3  4    *  6  7  8  9 10 11   12 13 14 15 16 17 18   19 20 21 22 23 24 25   26 27 28 29 30 31 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -