Solved

Unix ksh sed: cut string in two variables

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

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