![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read/writte/input data in file. | dorek | Shell Programming and Scripting | 0 | 06-22-2006 08:31 AM |
| Reading in data sets into arrays from an input file. | sidamin810 | Shell Programming and Scripting | 5 | 07-06-2005 08:54 AM |
| verification? | sheranjem | UNIX for Dummies Questions & Answers | 3 | 06-06-2005 02:08 PM |
| input of data | ljdav2 | Shell Programming and Scripting | 3 | 09-05-2004 11:01 PM |
| Bash overwrites data on screen!! | brain_processin | Shell Programming and Scripting | 4 | 03-13-2002 07:27 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hey guys i am trying to right script with this:
Input Valid user input can be in the following formats: Distance: in miles or kilometers, e.g. 100mi or 100km Speed: miles per hour or kilometers per hour, e.g. 100m/h or 100km/h Time: in hours and minutes, e.g. 1hr.20min, 1:20, or any integer which defaults to that number of hours, as in 3 (is 3 hours). Any combination of the above formats can be entered on the command line and in any order. Distance and speed can be entered as any decimal number, e.g. 50.8793mi, 78.405km/h Problem: I have no problem with working with speed and distance, the only problem now i am having is with time entered in this format 1hr.20min, i wanna be able to extract the numeric characters, I am guess i have to cut the variable into 2 pieces somehow, the length of the string can vary as it can be entered as 12hr.35min, so i am not sure how to do this. I wanna be able to be able to transform hour into minutesm thus if 1hr.20min is entered, i wanna use this data to get 60+20=80mins. Is there any way i can do it using sed or awk, i am not too familiar with it so any help would be appreciated. Thanks. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|