Sponsored Content
Full Discussion: Date substring from a string
Top Forums Shell Programming and Scripting Date substring from a string Post 302933401 by usrrenny on Thursday 29th of January 2015 06:25:48 PM
Old 01-29-2015
Date substring from a string

Hi, I have 2 statements in a file

Code:
 a.sh start time is Fri Jan  9 17:17:33 CST 2015
a.sh end time is Fri Jan  9 17:47:33 CST 2015

I am required to get only the time out of it. like

17:17:33 & 17:47:33


PLs suggest

Last edited by Don Cragun; 01-29-2015 at 08:07 PM.. Reason: Add CODE tags again.
 

10 More Discussions You Might Find Interesting

1. Programming

can i get a substring from a string?

for example, the string a is "abcdefg", can i get a substring "bcd" (from ato a) from string a? thank you (4 Replies)
Discussion started by: dell9
4 Replies

2. Shell Programming and Scripting

getting a substring from a string

hi all, I am trying to extract SUBSTRINGS out of a string using ksh. The string is "SAPR3K.FD0.FA.TJ.B0010.T050302" I tried using a= `expr substr $stringZ 1 2` which is giving me a syntax error, donno why?? any ideas why its not working?? I also tried echo "welcome" | awk '{... (3 Replies)
Discussion started by: maradona
3 Replies

3. UNIX for Dummies Questions & Answers

How to get the substring from the string

Hi All, Can anybody help me to get the substring from the given string. (3 Replies)
Discussion started by: Anshu
3 Replies

4. Shell Programming and Scripting

get substring from string

Hi All, Problem Description: XML_REP_REQUEST=`CONCSUB "$LOGIN" "SQLAP" "$RESP_NAME" "$USRNM" WAIT="Y" "CONCURRENT" "APPLICATION_SHORT_NAME" "CP_SHORT_NAME"` echo Report Request: $XML_REP_REQUEST --to print value in log file While execution the value of 'XML_REP_REQUEST' is 'Prozess... (5 Replies)
Discussion started by: suman.g
5 Replies

5. Shell Programming and Scripting

Help with string and substring also I/O

#!/bin/sh PRINTF=/usr/bin/printf PASSWD=/etc/passwd $PRINTF "Enter a UserID\n" read USERID if ; then $PRINTF "$USERID does not exist, please contact IT service\n" exit 1 fi USERHOME=`grep "^$USERID:" $PASSWD | awk -F : '{print $6}'` USERSHELL=`grep "^$USERID:"... (1 Reply)
Discussion started by: ikeQ
1 Replies

6. Shell Programming and Scripting

How to extract a substring from a string

Hi, I have an input string say for example: ABC,DEF,IJK,LMN,...,XYZ The above string is comma delimited. Now I have to extract the last part after the comma i.e. XYZ. :b: (3 Replies)
Discussion started by: bghosh
3 Replies

7. UNIX for Dummies Questions & Answers

substring a date

Hello I am trying to substring the month in a date string I am getting an error " bad substitution" #!/bin/ksh INPUT='20121225' echo ${$INPUT:5:2} exit 0 Very new in unix. Thanks. Please use code tags next time for your code and data. (9 Replies)
Discussion started by: lillyt2006
9 Replies

8. Shell Programming and Scripting

Remove a substring from string

Good morning friends, how can i remove a string with linux scripting from a file? In specific i want to remove from a file all the tweet names and links eg @aerta and links such as http://dst.co/pIiu3i9c Thanx!!! (4 Replies)
Discussion started by: paladinaeon
4 Replies

9. UNIX for Dummies Questions & Answers

Get date, change format and substring?

I'm somewhat new to shell scripting and I have a file that had a date in it. /somedirectory/datefile.txt I want to take the date in the file: 2013-06-12 and change the formate to 20130612 and have it as a variable/parm I also what to take that date 2013-06-12 and substring it. I know... (3 Replies)
Discussion started by: MJCreations
3 Replies

10. Shell Programming and Scripting

Extracting substring within string between 2 token within the string

Hello. First best wishes for everybody. here is the input file ("$INPUT1") contents : BASH_FUNC_message_begin_script%%=() { local -a L_ARRAY; BASH_FUNC_message_debug%%=() { local -a L_ARRAY; BASH_FUNC_message_end_script%%=() { local -a L_ARRAY; BASH_FUNC_message_error%%=() { local... (3 Replies)
Discussion started by: jcdole
3 Replies
Date::Manip::TZdata(3)					User Contributed Perl Documentation				    Date::Manip::TZdata(3)

NAME
Date::Manip::TZdata -- Internal module for working with the tzdata files SYNOPSIS
use Date::Manip::TZdata; $tzd = new Date::Manip::TZdata($dir); DESCRIPTION
This module is not intended for public use. It is used internally by the scripts used to analyze the time zone database and generate the modules for each time zone. The module is included in the distribution solely for the sake of completeness. Currently, no support is offered for this module, and it can (and may) change without notice. This module consists of routines for working with the tzdata files obtained from ftp://elsie.nci.nih.gov/pub/ . These files are updated several times a year and are the basis for time zone descriptions for most computer systems. At some point, I am interested in making this module a direct interface to the tzdata files, but in the limited amount of time I have to work on perl modules, other modifications to Date::Manip are much higher priority, so I'm not sure when (or if) this will ever happen. ROUTINES
new use Date::Manip::TZdata; $tzd = new Date::Manip::TZdata($dir); This finds and reads in all the tzdata. If $dir is passed in, it is the directory where a tzdata directory is located. It defaults to the current directory. KNOWN LIMITATIONS
Some assumptions and limitations are assumed in the logic of this module. When a time change occurs, the time may change backwards or forwards. Time changes rules are listed on a per-year basis. It is assumed that time changes will not occur so close to the end or start of the year as to cross the year boundary (in other words, the year will not change as a result of the time change). This is not accounted for, and it is hoped that this situation will never occur. Also, because this module is strictly limited to 4 digit positive years (regardless of whether it is wallclock or universal time), and because various parts of the module switch back and forth, valid times for this module are from Jan 2, 0001 to Dec 30, 9999. This ensures that conversions from wallclock to universal or vice versa will never make dates occur in the year 0000 or 10000. KNOWN BUGS
None known. BUGS AND QUESTIONS
Please refer to the Date::Manip man page for information on submitting bug reports or questions to the author. AUTHOR
Sullivan Beck (sbeck@cpan.org) perl v5.12.1 2010-01-12 Date::Manip::TZdata(3)
All times are GMT -4. The time now is 07:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy