473,666 Members | 2,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Only fetch date from array.

41 New Member
Hi,

I have a flat file like:

106|4 |ABC|0000000280 | 919886046726| 253436| TP001| 1| 4200| 998607230300| 12345630864|BUN DLE| ACE1| | | | 00e142daaf20b96 5| 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 1814
toolic
70 Recognized Expert New Member
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
2154
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 parameters? A function like file("/path/to/file",100,230) which would return lines 100 through 230 as an array.
0
1500
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 a looping example using cursors on the net, but I don't know how to declare a read only cursor. Note: my objective is to simulate an array of field names for creating an xml doc/string (to use with OpenXML function). So I created a small table...
1
3844
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 are quite a few things that I learned that I did not know before. For example, while I knew that the new and delete operators can be overloaded for classes, I did not know that that the global new and delete operators can also be overloaded. ...
1
1241
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 array, it is displayed as the date with time (e.g. 5/9/2005 12:00:00 AM). I don't want the time function to be part of the item to be added in the array. I have tried
3
1689
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 chronological order. So, as an example, if the table contains 1. 2005-12-01 2. 2006-03-01 3. 2006-06-01 4. 2006-09-01
10
13194
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 fetch works as I would expect it to on the 2 rows, but then when I do my next fetch, the program ends abnormally. My next step is to check for sqlcode 100, as I would expect it to be, but my program never even gets to this step.
0
1476
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
3160
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
2077
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 his own feature to export the details. But, by this its not possible to extract the body of the mail. Here, I want to know, is it possible to fetch mail details like sender email, sender date, received date, subject, body of the mail etc and save in...
0
8438
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8863
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7376
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.