- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how can do this date conversion?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2003 05:02 PM
03-04-2003 05:02 PM
-rw-rw-rw- 1 pin pin 1 Mar 5 08:54 core
the core should be rename core.200303050854
i have no idea how can i do it in some simple way
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2003 05:43 PM
03-04-2003 05:43 PM
SolutionI tried to write a script on the fly. Create dummy core files in subdirectories any test directory and run this against the directory. Make sure it works as you need before running it on the system.
-Sri
#!/usr/bin/ksh
if [ $# -ne 1 ]
then
echo "Usage:$0 Directory"
exit 1
fi
DIR=$1
chart="
Jan-01
Feb-02
Mar-03
Apr-04
May-05
Jun-06
Jul-07
Aug-08
Sep-09
Oct-10
Nov-11
Dev-12
"
move()
{
file=$1
Month=$(ls -al $file |awk '{print $6}')
DAY=$(ls -al $file |awk '{print $7}')
TimeYear=$(ls -al $file |awk '{print $8}')
for i in $chart
do
echo $i |grep $Month > /dev/null 2>&1
if [ $? = 0 ]
then
MON=$(echo $i |awk '{FS="-";print $2}')
fi
done
echo $TimeYear |grep ":" > /dev/null 2>&1
if [ $? = 0 ]
then
HR=$(echo $TimeYear|awk '{FS=":";print $1}')
MIN=$(echo $TimeYear|awk '{FS=":";print $2}')
YEAR=$(date |awk '{print $6}')
else
HR=00
MIN=00
YEAR=$TimeYear
fi
mv $file $file.${YEAR}${MON}${DAY}${HR}${MIN}
}
for FILE in $(find $DIR -name core)
do
move $FILE
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2003 06:51 PM
03-04-2003 06:51 PM
Re: how can do this date conversion?
For this format: filename.yyyymmddhhmm
DATE=$(date +%Y +%b +%d +%H +%M)
filename.$DATE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2003 07:08 PM
03-04-2003 07:08 PM
Re: how can do this date conversion?
Do a man on date and it will tell you more for varios output format...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2003 07:15 PM
03-04-2003 07:15 PM
Re: how can do this date conversion?
-Sri