The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to extract date with time from file prash_b Shell Programming and Scripting 5 06-18-2008 05:30 AM
Script to Extract time from log files and write to a excel santosham Shell Programming and Scripting 0 06-06-2008 10:28 AM
Script to Extract time from log files and write to a excel santosham UNIX for Advanced & Expert Users 0 06-06-2008 10:27 AM
extract last modified time of file in form of YYYYMMDD itsme_maverick Shell Programming and Scripting 3 05-28-2008 09:01 AM
How to extract two words at the same time. Aejaz UNIX for Advanced & Expert Users 6 04-30-2008 06:09 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-08-2007
Registered User
 

Join Date: Apr 2007
Posts: 24
Extract TIME

Hey guys.

How would I go about extracting the time from the system clock and inserting it into a variable?

Any thoughts?
Reply With Quote
Forum Sponsor
  #2  
Old 05-08-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
Look at the date command. The different formats will allow you to save that value in a variety of ways.
Reply With Quote
  #3  
Old 05-08-2007
Registered User
 

Join Date: Apr 2007
Posts: 24
I think I got it,

ts=`date +%H%M`

Thanks again.
Reply With Quote
  #4  
Old 05-08-2007
Registered User
 

Join Date: Apr 2007
Posts: 24
I was givin the task to, Glean the time only and write a small script that echo’s before or after the time you specify.

Would this work:

ts=`date +%H%M`

echo ts

if ts > 0900
echo after
else
echo before
fi
Reply With Quote
  #5  
Old 05-08-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
Is this homework? If it is, its against the rules.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0