The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 10-26-2005
Registered User
 

Join Date: Sep 2005
Posts: 130
Red face please help

Dear friends



time is like this 23:23:20

Now i want to read like this
2323 means i dont want colon between hours and minutes and i should leave seconds


so at last i want 2323 from above mentioned time

i think awk will solve my problem

please unix shell script syntax


urgent

regards

rajan
Reply With Quote
Forum Sponsor
  #2  
Old 10-26-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,683
Code:
echo "23:23:23" | awk -F":" '{ print $1$2 }'
Reply With Quote
  #3  
Old 10-26-2005
Registered User
 

Join Date: Sep 2005
Posts: 130
thank u vino

u served my purpose


regards

rajan
Reply With Quote
  #4  
Old 10-26-2005
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,609
one more way,

echo "23:23:20" | sed -e 's/://;s/:.*//'
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:05 AM.


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