There's a comma in the example data provided. Most of the CSV's I've
dealt with also quote values which were strings. If this is the case,
an ugly solution would be to use something along the lines of '","' as
the delimiter, take into account any possible fields which aren't quoted
(it should be
On 10/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> One of the column in csv file is Fri, Oct 12 10:32 AM. I am trying ti split
> the csv file for checking a column value. when spliting I wanted to take Fri,
> Oct 12 10:32 AM as a single value. How can I use split?
>
> Thanks
> Manoj
If
On 10/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> One of the column in csv file is Fri, Oct 12 10:32 AM. I am trying ti split
> the csv file for checking a column value. when spliting I wanted to take
> Fri, Oct 12 10:32 AM as a single value. How can I use split?
You don't want split fo
One of the column in csv file is Fri, Oct 12 10:32 AM. I am trying ti split the
csv file for checking a column value. when spliting I wanted to take Fri, Oct
12 10:32 AM as a single value. How can I use split?
Thanks
Manoj
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
John wrote:
>
> Here is a little quiz for you beginners out there. split() treats its
> first argument as a regular expression. There are TWO exceptions where
> the first argument does not behave the same as a normal regular
> expression. What are they?
I know! Please sir!
Actually this 'backw
Wiggins d Anconia <[EMAIL PROTECTED]> wrote:
:
: > On Monday, December 15, 2003 03:05, John W. Krahn wrote:
: >
: > > Here is a little quiz for you *BEGINNERS* out there.
[emphasis added]
:
: But parentheses are normal in a regex, though granted the
: return is odd. I would guess as the second
> On Monday, December 15, 2003 03:05, John W. Krahn wrote:
>
> >Here is a little quiz for you beginners out there. split() treats its
> >first argument as a regular expression. There are TWO exceptions where
> >the first argument does not behave the same as a normal regular
> >expression. Wha
On Monday, December 15, 2003 03:05, John W. Krahn wrote:
>Here is a little quiz for you beginners out there. split() treats its
>first argument as a regular expression. There are TWO exceptions where
>the first argument does not behave the same as a normal regular
>expression. What are they?
T
"John W. Krahn" wrote:
> "R. Joseph Newton" wrote:
> >
> > Joel Newkirk wrote:
> >
> > > Well, actually they don't, since the 'bare' # will be interpreted as
> > > starting a comment, while the one in quotes won't... ;^)
> > >
> > > The op's assignment was assigning 'split(/' to @temp...
> >
> >
On Sun, 2003-12-14 at 18:11, Joel Newkirk wrote:
> >
> > The first argument to split is converted to a regular expression and the
> > '#' character is not special in a regular expression so split/#/ and
> > split'\#' do exactly the same thing.
>
> Well, actually they don't, since the 'bare' # wi
"R. Joseph Newton" wrote:
>
> Joel Newkirk wrote:
>
> > Well, actually they don't, since the 'bare' # will be interpreted as
> > starting a comment, while the one in quotes won't... ;^)
> >
> > The op's assignment was assigning 'split(/' to @temp...
>
> Did you test.
Did YOU test?
> The only
On Dec 14, 2003, at 6:42 PM, R. Joseph Newton wrote:
The only problem I see with John's code is that it addumes that
the print statement will print a newline, which it doesn't [at least
on my
installation of V5.8].
Na, John's smarter than you give him credit for here. Here was the
code:
On Dec
Joel Newkirk wrote:
>
> On Sun, 2003-12-14 at 14:52, John W. Krahn wrote:
> > Josimar Nunes De Oliveira wrote:
> > >
> > > From: "Perl" <[EMAIL PROTECTED]>
> > > >
> > > > @temp = split(/#/, "abc#def#ghi#jkl") ;
> > >
> > > @temp = split('\#', "abc#def#ghi#jkl") ;
> >
> > The first argument to s
Joel Newkirk wrote:
> > The first argument to split is converted to a regular expression and the
> > '#' character is not special in a regular expression so split/#/ and
> > split'\#' do exactly the same thing.
>
> Well, actually they don't, since the 'bare' # will be interpreted as
> starting a c
On Sun, 2003-12-14 at 14:52, John W. Krahn wrote:
> Josimar Nunes De Oliveira wrote:
> >
> > From: "Perl" <[EMAIL PROTECTED]>
> > >
> > > @temp = split(/#/, "abc#def#ghi#jkl") ;
> > >
> > > doesn't seem to work.
> > >
> > > am i doing anything wrong here ?
> >
> > Try this:
> >
> > @temp = spl
Josimar Nunes De Oliveira wrote:
>
> From: "Perl" <[EMAIL PROTECTED]>
> >
> > @temp = split(/#/, "abc#def#ghi#jkl") ;
> >
> > doesn't seem to work.
> >
> > am i doing anything wrong here ?
>
> Try this:
>
> @temp = split('\#', "abc#def#ghi#jkl") ;
> foreach (@temp){
> print "\n", $_;
> }
The
Try this:
@temp = split('\#', "abc#def#ghi#jkl") ;
foreach (@temp){
print "\n", $_;
}
Josimar
- Original Message -
From: "Perl" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 14, 2003 3:16 AM
Subject: Split que
On Sat, Dec 13, 2003 at 09:16:35PM -0800, Perl wrote:
> Hi,
>i am new to Perl.
>here is my question
>
> i have a character string like abc#def#ghi#jkl
>
> i want to split the string based on the delimiter # so that i get
> something like this :
>
> abc def ghi jkl
>
> Bu
Perl wrote:
>
> Hi,
Hello,
>i am new to Perl.
>here is my question
>
> i have a character string like abc#def#ghi#jkl
>
> i want to split the string based on the delimiter # so that i get
> something like this :
>
> abc def ghi jkl
>
> But
>
> @temp = split(/#/, "ab
Hi,
i am new to Perl.
here is my question
i have a character string like abc#def#ghi#jkl
i want to split the string based on the delimiter # so that i get
something like this :
abc def ghi jkl
But
@temp = split(/#/, "abc#def#ghi#jkl") ;
doesn't seem to work.
am i do
your project looks nice and usefull. What i am making will
utilze graphs & a sql database. I want to graph all packets droped
the last-hour, today, this-week, this year.
Eventully i would like to establish traffic patterns
so i can wright more abstract rules that what iptables
can do. If anyone is
Jdavis wrote:
>>
>> ($left,$right) = split(/word/, $sentence);
>>
>
> I am trying this but its not working. Im lost :)
> could someone take a look...
>
> This is the beggining of a scrip to make reports
> based on droped iptable packets
I've done something like this with my tailfilter project
jdavis wrote:
> I found the error. Sorry to answer my own queston
> I was trying
>
> (@bad,@good) = split(/ /, $string);
>
> when i needed
>
> ($bad,$good) = split(/ /, $string);
>
> thanks for all the help.
>
> jd
If you had chosen to
use strict;
your compiler would have brought this to your att
I found the error. Sorry to answer my own queston
I was trying
(@bad,@good) = split(/ /, $string);
when i needed
($bad,$good) = split(/ /, $string);
thanks for all the help.
jd
On Mon, 2003-03-31 at 16:18, jdavis wrote:
> >
> > ($left,$right) = split(/word/, $sentence);
> >
>
> I am trying
>
> ($left,$right) = split(/word/, $sentence);
>
I am trying this but its not working. Im lost :)
could someone take a look...
This is the beggining of a scrip to make reports
based on droped iptable packets
thanks
jd
#
#!/usr/bin/perl -w
$fi
;
-Original Message-
From: jdavis [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 2:36 PM
To: perl
Subject: Simple split question
Hello,
I have a sentince I would like to split on a word and keep everything
right of the "split word". I cant seem to get this to work. Coul
> Hello,
> I have a sentince I would like to split on a word and keep
> everything right of the "split word". I cant seem to get this
> to work. Could over me some advice.
Split returns in list context so ::
@stuff = split(/word/, $sentence);
Or
($left,$right) = split(/word/, $sentence);
A
Hello,
I have a sentince I would like to split on a word and keep everything
right of the "split word". I cant seem to get this to work. Could
over me some advice.
Thanks,
--
jd
[EMAIL PROTECTED]
Bad spellers of the world untie!
"I can't tell if I have worked all my life or
if I have never w
justino berrun wrote:
> #hello, is there a way to split a string between a digit and character
> $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would make three new
>strings
Try:
(my $ElementString = $string) =~ s /(\d+)(\D+)/$1-$2/g;
print "$ElementString\n";
$ElementString is th
Rob Dixon wrote:
>
> Justino Berrun wrote:
> > #hello, is there a way to split a string between a digit and character
> > #without losing the digit or the character
> > #Any help would be very appreciated
> >
> > $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would
> > make three new
Justino Berrun wrote:
> #hello, is there a way to split a string between a digit and character
> #without losing the digit or the character
> #Any help would be very appreciated
>
> $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would
> make three new strings
>
> @newstrings=split(/(\
justino berrun wrote:
> #hello, is there a way to split a string between a digit and character
> #without losing the digit or the character
> #Any help would be very appreciated
>
> $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would
> make three new strings
>
> @newstrings=split(
On Wed, 22 Jan 2003 02:46:27 +0800, Justino Berrun wrote:
> #hello, is there a way to split a string between a digit and character
> #without losing the digit or the character
> #Any help would be very appreciated
>
> $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would make three
#hello, is there a way to split a string between a digit and character
#without losing the digit or the character
#Any help would be very appreciated
$string='hello...4546perl...2366Pogrammers..3435'; #e.g. would make three new
strings
@newstrings=split(/(\d)([a-zA-Z])/,$string);
> The reason your code breaks is because you are
> misunderstanding split(); it does NOT return what
> the regex matched.
>
> split /=/, "a=b"
>
> does not return ("a", "=", "b"). It returns ("a", "b").
Unless of course you write split as:
split /(=)/, "a=b";
But you rarely, if ever, need
On Mar 10, Karsten Borgwaldt said:
>key=value
>key2=value2
>
>
>This is the sourcecode:
I can assure you it isn't; your code assigns to $1, $2, and $3 -- you
can't do that.
>open(file, "< foo.bar");
If you had warnings on, you'd be told that filehandles should be written
in uppercase for s
Hi all,
i have a problem to split data of a file.
The data has the following structure :
key=value
key2=value2
When reading this file, there's no problem, but if I want to split the
lines...
This is the sourcecode:
open(file, "< foo.bar");
@myArray = ;
close(file);
foreach (@myArray) {($
On Aug 13, Scott and Kristin Seitz said:
>$CharSep="\|";
The double quoted string "\|" is still just "|".
Use single quotes or the quotemeta() function.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http:/
Scott,
The problem is that | is a pattern metacharacter, and still needs to be
escaped.
try:
my @arr = split(/\Q$CharSep/, $_);
#
I have a delimited text file with a vertical bar (|) as the column
delimiter. When I execute the following statement
I have a delimited text file with a vertical bar (|) as the column delimiter. When I
execute the following statement...
@Line = split(/\|/, $_);
...I get the expected results.
When I execute the following...
$CharSep="\|";
@Line = split(/$CharSep/, $_);
...the file seems to break at every c
Hello Brett,
Tuesday, July 03, 2001, Brett W. McCoy <[EMAIL PROTECTED]> wrote:
>> >> > > > Unpack works well with fixed format data like this.
>> >> > >
>> >> > > Why would you use unpack when this can be easily split apart with a regex?
>> >> > > I'd think unpack would be overkill!
>> >>
>> >>
> > >> > > > Unpack works well with fixed format data like this.
NB: *fixed format* - i.e. unchanging throughout the data.
> the flexibility of a regular expression. If the date style changes to,
> say, 02July01 (instead of 2July2001), the regula
On Jul 3, Maxim Berlin said:
> my ($month, $day, $year) = /(\d+)(\D+)(\d+)/;
I'd be evil and do:
my ($mon, $day, $yr) = split /(\D+)/;
Now *that* is quite nice, in my opinion.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Rin
On Tue, 3 Jul 2001, Maxim Berlin wrote:
> Tuesday, July 03, 2001, Brett W. McCoy <[EMAIL PROTECTED]> wrote:
>
> >> > > > Unpack works well with fixed format data like this.
> >> > >
> >> > > Why would you use unpack when this can be easily split apart with a regex?
> >> > > I'd think unpack would
on a side note, if you CAN use perls internal char classes you really want to do
that
firstly to avoid typos, secondly, they're much faster.
and if you're using the same regexp over and over again, you *might* want to
concider building it outside the loop with the /o switch
(this all performace b
Hello Brett,
Tuesday, July 03, 2001, Brett W. McCoy <[EMAIL PROTECTED]> wrote:
>> > > > Unpack works well with fixed format data like this.
>> > >
>> > > Why would you use unpack when this can be easily split apart with a regex?
>> > > I'd think unpack would be overkill!
>>
>> why is it overkill
On Tue, 3 Jul 2001, Luke Bakken wrote:
> > > > Unpack works well with fixed format data like this.
> > >
> > > Why would you use unpack when this can be easily split apart with a regex?
> > > I'd think unpack would be overkill!
>
> why is it overkill any more that a regex?
Are you saying we shou
$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/;
>
> It makes me sleeper at night
>
>
> - Original Message -
> From: "John Edwards" <[EMAIL PROTECTED]>
> To: "'Will Crain'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>
---
From: "John Edwards" <[EMAIL PROTECTED]>
To: "'Will Crain'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 03, 2001 3:54 PM
Subject: RE: A Split Question
> Sorry to pick holes in your first post to the list ;) but this part of
y
01 15:41
To: [EMAIL PROTECTED]
Subject: RE: A Split Question
-- Original Message --
>My file has dates in it that either come out as "2Jul2001" or "21Jul2001".
> So one or two digits for the day, three for the month, and four for the
>year.
>
>So I would like t
-- Original Message --
>My file has dates in it that either come out as "2Jul2001" or "21Jul2001".
> So one or two digits for the day, three for the month, and four for the
>year.
>
>So I would like to split out the day, month, year, and am interested in
>splitting techniques, where there are n
> > Unpack works well with fixed format data like this.
>
> Why would you use unpack when this can be easily split apart with a regex?
> I'd think unpack would be overkill!
>
> -- Brett
if you had thousands of dates to split up, unpack is much faster than
regexes. way way faster.
Luke
On Tue, 3 Jul 2001, Luke Bakken wrote:
> my @dates = qw(2Jul2001 21Jul2001);
>
> for my $date (@dates)
> {
> my ($month, $day, $year) =
> length $date == 8 ?
> unpack 'AA3A4', $date :
> unpack 'A2A3A4', $date;
>
>
my @dates = qw(2Jul2001 21Jul2001);
for my $date (@dates)
{
my ($month, $day, $year) =
length $date == 8 ?
unpack 'AA3A4', $date :
unpack 'A2A3A4', $date;
print "M: ", $month, "\tD: ", $day, "\tY: ",
01
>my $dateis = "2Jul2001";
>my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/;
>
>print "$date - $month - $year \n";
>
>:)
>
>with regards,
>
>Pierre
>
>- Original Message -
>From: <[EMAIL PROTECTED]>
ear\n";
}
John
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 03 July 2001 12:24
To: [EMAIL PROTECTED]
Subject: A Split Question
Hi.
My file has dates in it that either come out as "2Jul2001" or "21Jul2001".
So one or two digits for the day,
my $dateis = "2Jul2001";
my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/;
print "$date - $month - $year \n";
:)
with regards,
Pierre
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 03
Hi.
My file has dates in it that either come out as "2Jul2001" or "21Jul2001". So one or
two digits for the day, three for the month, and four for the year.
So I would like to split out the day, month, year, and am interested in splitting
techniques, where there are no delimeters.
Of course
At 01:40 2001.07.01, Jeff 'japhy' Pinyan wrote:
>On Jun 30, Sanjeeb Basak said:
>
>>I want to perform a simple split operation, but can't get the regular expr
>>working. Can anybody help me on this?
>>
>>my $line from a file read is:
>>xyz abc 12sd "pqr stz" dfg (delimited by blank char).
>>
>>I'm
On Jun 30, Sanjeeb Basak said:
>I want to perform a simple split operation, but can't get the regular expr
>working. Can anybody help me on this?
>
>my $line from a file read is:
>xyz abc 12sd "pqr stz" dfg (delimited by blank char).
>
>I'm doing
>my ($par1, $par2, $par3, $par4, $par5) = split(/
Hi,
I want to perform a simple split operation, but can't get the regular expr
working. Can anybody help me on this?
my $line from a file read is:
xyz abc 12sd "pqr stz" dfg (delimited by blank char).
I'm doing
my ($par1, $par2, $par3, $par4, $par5) = split(/ /, $line);
and I'm getting
$par4 =
z,,,
On Thu, 28 Jun 2001 16:32:28 -0400, Seitz, Scott said:
> I'm having trouble with what I think is a very simple split question.
>
> I've got a line of text something like:
>
> DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimVie
ot;([^"]+)"/g;
That gives me %foo as (according to Data::Dumper):
{
1 => 'All',
2 => 'Some',
3 => 'Most',
4 => 'None'
};
> -Original Message-
> From: Seitz, Scott [mailto:[EMAIL PROTECT
--- "Seitz, Scott" <[EMAIL PROTECTED]> wrote:
> I'm having trouble with what I think is a very simple split question.
>
> I've got a line of text something like:
>
> DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimV
On Thu, 28 Jun 2001, Seitz, Scott wrote:
> I'm having trouble with what I think is a very simple split question.
>
> I've got a line of text something like:
>
> DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"
mumble* Took me a few minutes to figure out why!
- Original Message -
From: "Seitz, Scott" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 28, 2001 2:32 PM
Subject: Simple Split Question
> I'm having trouble with what I think is a very simple
I'm having trouble with what I think is a very simple split question.
I've got a line of text something like:
DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"
I want a hash with (1, "All", 2, "Some", 3, &qu
Jeff Pinyan <[EMAIL PROTECTED]> writes:
> On May 31, Pedro A Reche Gallardo said:
>
> >How can I split a string of caracters -any but blank spaces- into
> >the individual caracters?
>
> So you want to split "what's up, doc?" into
>
> @chars = qw( w h a t ' s u p , d o c ? );
>
> That is
--- Jeff Pinyan <[EMAIL PROTECTED]> wrote:
> On May 31, Paul said:
>
> >Still, though, won't that return all the *strings* as elements,
> rather
> >than the individual characters? and wouldn't \S* solve that
> difference?
>
> We're only matching ONE character at a time:
>
> @all_chars = $st
On May 31, Paul said:
>Still, though, won't that return all the *strings* as elements, rather
>than the individual characters? and wouldn't \S* solve that difference?
We're only matching ONE character at a time:
@all_chars = $str =~ /./sg;
@all_ws = $str =~ /\s/g;
@all_non_ws = $str
--- Jeff Pinyan <[EMAIL PROTECTED]> wrote:
> On May 31, Paul said:
>
> >> my @chars = $string =~ /\S/g;
> >
> >I've seen a couple of people doing this, and maybe I'm just
> confused,
> >but
> >
> >Isn't the point of the original request to split into the original
> >characters, but leave *ou
On May 31, Paul said:
>> my @chars = $string =~ /\S/g;
>
>I've seen a couple of people doing this, and maybe I'm just confused,
>but
>
>Isn't the point of the original request to split into the original
>characters, but leave *out* the spaces?
>
>and isn't \S any nonspace?
>
>So, if you split
--- "Randal L. Schwartz" <[EMAIL PROTECTED]> wrote:
> > "Pedro" == Pedro A Reche Gallardo
> <[EMAIL PROTECTED]> writes:
>
> Pedro> How can I split a string of caracters -any but blank spaces-
> into
> Pedro> the individual caracters?
>
> my @chars = $string =~ /\S/g;
I've seen a couple
--- Pedro A Reche Gallardo <[EMAIL PROTECTED]> wrote:
> Hi all,
> How can I split a string of caracters -any but blank spaces- into
> the individual caracters?
> Cheers
I'd say
@chars = split /\s*/, $string;
That will split between characters that have any number of spaces
between them -
> "Pedro" == Pedro A Reche Gallardo <[EMAIL PROTECTED]> writes:
Pedro> How can I split a string of caracters -any but blank spaces- into
Pedro> the individual caracters?
my @chars = $string =~ /\S/g;
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL
> How can I split a string of caracters -any but blank spaces- into
> the individual caracters?
Try something like this:
my @arr = split //, "sometext";
foreach $i (@arr) {
print "$i\n";
}
-- Brett
Brett W. McCoy
Software Engineer
Broadsoft, Inc.
240-364-5225
[EMAIL PROTECTED]
On May 31, Pedro A Reche Gallardo said:
>How can I split a string of caracters -any but blank spaces- into
>the individual caracters?
So you want to split "what's up, doc?" into
@chars = qw( w h a t ' s u p , d o c ? );
That is, every character except spaces?
First, remove spaces from t
Hi all,
How can I split a string of caracters -any but blank spaces- into
the individual caracters?
Cheers
-
--
***
PEDRO a. RECHE gallardo, pHDTL: 617 632 3824
Scientist, Mol.Immnunol.Foundation, FX: 617
78 matches
Mail list logo