[continue reading…]
date command
[continue reading…]
[continue reading…]
I need to create a log file using the following format:
myapp_monday.log
myapp_tuesday.log
….
…
myapp_sunday.log
How do I create log filename with day of the week in it under Linux or Unix operating systems?
[continue reading…]
I‘m using the date +’%D_%T’ to store Unix system date and time in a shell variable called $_now:
_now=”$(date +’%D_%T’)”
echo $_nowOutputs:
01/20/12_16:10:42
I’d like to replace / and : with _. I’m aware of the following sed command:
sed ‘s/\//_/g
> s/:/_/g’Outputs:
01_20_12_16_14_09
How do I specify two pattern within the same sed command to replace | and : with _ so that I can get output as 01_20_12_16_10_42?
[continue reading…]
I recently noticed that one of my UNIX servers was about 4 hours behind the correct time. I wanted to correct the date and time manually. How do I set date and/or time under UNIX operating systems using command line options?
[continue reading…]
I want to increment the date under UNIX or Linux operating system while writing shell scripts. For example Apr/27/2011 should be incremented as Apr/28/2011 and so on. How do I increment a date in UNIX or Linux shell?
[continue reading…]
[continue reading…]