Solved

Unix ksh sed: cut string in two variables

Posted on 2011-03-23
2
1,883 Views
Last Modified: 2012-05-11
How do I create a seperate Date and Time variable from this string...
DateTime=2011-03-21T12:11:00

So that it becomes...
Date=2011-03-21
Time=12:11:00


Thank you for your much appreciated help.
0
Comment
Question by:Watnog
2 Comments
 
LVL 14

Accepted Solution

by:
sjm_ee earned 500 total points
ID: 35196880
In ksh:

# echo $Date
2011-03-21T12:11:00
# echo $DateTime | IFS="T" read Date Time
# echo $Date
2011-03-21
# echo $Time
12:11:00


0
 

Author Closing Comment

by:Watnog
ID: 35196909
Very nice. Thanks!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question