Solved

Unix ksh sed: cut string in two variables

Posted on 2011-03-23
2
1,873 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

919 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now