473,395 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Only fetch date from array.

Hi,

I have a flat file like:

106|4 |ABC|0000000280| 919886046726| 253436| TP001| 1| 4200| 998607230300| 12345630864|BUNDLE| ACE1| | | | 00e142daaf20b965| 99| |13|01|NA|2009-10-20 13:00:05| 110| 110| | 521000|3|N| | PQRS| N| CHARGE| 110| PER_TIME_02| 240| 59992000| 0| |


I have already split the "|" delimetere & store into an array.

My Question is i want to fetch the date format ( "2009-10-20" ) from "2009-10-20 13:00:05" elements in array & store into that array.

I have made a script like below:

#!/usr/bin/perl

print ("Read actual file\n");

open (FILE,"actual") || die("Can't Open actual");

foreach $data(<FILE>)
{
@data = split(/\|/, $data);
}
close(FILE);

print "@data";


So i need "2009-10-20" instead of "2009-10-20 13:00:05" in @data.

Plz, somebody help.

Thanks
DKS
Oct 27 '09 #1
1 1805
toolic
70 Expert
Once you have '2009-10-20 13:00:05' in a string,
just split the string on whitespace and grab the
1st element of the returned list.
Oct 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Sugapablo | last post by:
file() works great, until you start looking at file that are very large, say 134MB. Is there any function that will return an array for each line of a file, but only for lines given as...
0
by: Ed | last post by:
Hello, I posted a question about looping with Select in a While loop, a few days ago. Repliers to my post advised me that a Cursor would be much better (thanks all for your replies). I found...
1
by: Nimmi Srivastav | last post by:
There's a rather nondescript book called "Using Borland C++" by Lee and Mark Atkinson (Que Corporation) which presents an excellent discussion of overloaded new and delete operators. In fact there...
1
by: zoneal | last post by:
Hi, I am quite new in VB.NET and I was wondering if someone could help me with this problem: I declared the following array: dim ArrayList() as date Problem is, whenever I add a date to the...
3
by: thisisjim | last post by:
I have a table with a number of fields, one being a date. What I'm looking to do is take a date variable, and then select only one row - that being the one that contains the next date value in...
10
by: scoonie999 | last post by:
I'm having a problem that I can't seem to find any solution for online. I'm using a cursor in a cobol program to fetch some data. I know for a fact that the select should return 2 rows. The...
0
by: PRIYA6930 | last post by:
Hi, I have a situation where I am writing code to fetch rows from a db2 table bases on spcefic date. I have declared a cursor and passing the parameters to it this way :some date Eg
1
by: naveenkongati | last post by:
Hi, How do we fetch only date and month from date column (Ex: 2008-11-10) in Mysql? Thanks
1
by: robin1983 | last post by:
Dear All, How are you everyone! I need a help from you all. Firstly, I want to know is it possible to fetch the email details from the Outlook to Excel or Database by using PHP. MS outlook has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.