splitting on dot in perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting splitting on dot in perl
# 1  
Old 09-12-2005
splitting on dot in perl

I am trying to split input that looks like
,2005-09-12 01:45:00.000000,2005-09-12 01:48:18.000000,

I want to split on the dot .

What I am using is ($ev_time,$rol)=split(/\./),$inputfile;

This does not recognize the dot as what I want to split on.
# 2  
Old 09-12-2005
Why do you put the pattern in parantheses?
Try ($ev_time,$rol)=split /\./,$inputfile;
And I beleive that $inpfile is a string containing you value. True?
# 3  
Old 09-14-2005
Is '$inputfile' a variable containing a filename which contains your data or doe it contain the actualy string. If the latter then odashe's code works, otherwise you need a little more.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Splitting a file and creating new files using Perl script

Hi All, I am new to Scripting language. I want to split a file and create several subfiles using Perl script. Example : File format : Sourcename ID Date Nbr SU IMYFDJ 9/17/2012 5552159976555 SU BWZMIG 9/14/2012 1952257857887 AR PEHQDF 11/26/2012 ... (13 Replies)
Discussion started by: Deepak9870
13 Replies

2. Shell Programming and Scripting

perl : splitting the data into 2 different variables

I have a perl variable which contains the below value. $var1 = "2% / 51%" Now I would like to split the data into 2 different variables. For example $part1 = 2 $part2 = 51 Could anyone please help me in this regard ? Regards, GS (4 Replies)
Discussion started by: giridhar276
4 Replies

3. Shell Programming and Scripting

perl dot escaping issue

Hello, I'm trying to figure out why this perl command does not work. I want to split a string on dot delimiter. If I try with colon the result is fine: > echo -n "hello:world" | perl -F/:/ -ane 'print "$F\n"' >world As expected I get the good result, but by typing: > echo -n... (3 Replies)
Discussion started by: Dedalus
3 Replies

4. Shell Programming and Scripting

Replace dot with semicolon in PERL

Hi, I have a file in PERL in the following pattern filename| 06-Dec-11 03.04.14.000000 PM filename1| 06-Dec-11 05.05.14.000000 PM I need to replace .(dot) with :(semicolon) in the timestamp value of the file How can this be done. Any help will be appreciated Thanks in advance (5 Replies)
Discussion started by: irudayaraj
5 Replies

5. Shell Programming and Scripting

Splitting a file into several smaller files using perl

Hi, I'm trying to split a large file into several smaller files the script will have two input arguments argument1=filename and argument2=no of files to be split. In my large input file I have a header followed by 100009 records The first line is a header; I want this header in all my... (9 Replies)
Discussion started by: ramky79
9 Replies

6. Shell Programming and Scripting

perl, splitting out specific parts of the string

Hi there, I have an output from a command like this # ypcat -k netgroup.byuser| grep steven steven.* users_main,users_sysadmin,users_global,users_backup_team and wanted to pull the 'users' netgroups returned into a perl array, that will look like this users_main... (2 Replies)
Discussion started by: rethink
2 Replies

7. Shell Programming and Scripting

PERL need help splitting argument

If i have a script name.pl I run it like name.pl -v file.txt -t ext2 -u user -j how can I edit the array @ARGV so when my script calls $ARGV = -v file.txt $ARGV = -j (2 Replies)
Discussion started by: 3junior
2 Replies

8. Shell Programming and Scripting

removing DOT by using perl

Hi Friends, I have a variable which has a number (e.g. 12.1234). I want to remove "." (dot) from that number i.e. 121234 I want to do this using perl. Can you please guide me Thank you Anushree (2 Replies)
Discussion started by: anushree.a
2 Replies

9. Shell Programming and Scripting

Perl Programming for Splitting

Hi, I am extracting SQL queries into a file and the file is as follows ********************************************************* select BatchKey ,restartStatus ,batchContextBuffer ,batchPgmId ,StartKey , EndKey ,Mcbatchcontrol_ver from qsecminload.Mcbatchcontrol_t where RefId = :1 ... (5 Replies)
Discussion started by: sagarbsa
5 Replies

10. Shell Programming and Scripting

Perl - Need help on splitting string

Let's say I have a very long string with no spaces but just words stored in $very_long_string. $very_long_string = "aaaaaaaaaaabbbbbbbbbbbccccccccccccdddddddddddd"; I can do this to split the string into 1 character each and store them in an array: @myArray = split(//, $very_long_string); ... (3 Replies)
Discussion started by: teiji
3 Replies
Login or Register to Ask a Question