Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Answer: How do I print only some letters of this string

( #19213=categorized answer: print w/ replies, xml ) Need Help??

Q&A > input and output > How do I print only some letters of this string contributed by nuance

Apologies: I'm aware that these lines are much too long, unfortunately, you can't really see the structure of the data if I wrap them.

I've reformatted your question and it looks like what you're actually trying is to limit the string to 100 chatracters, like this :

2000/06/19 15:22:13 NIB1_BSX Communications Alarm + Critical OMC and equipment Connection broken 2000/06/19 15:22:15 NIB1_MSC Communications Alarm + Critical OMC and equipment Connection broken and up 2000/06/19 16:03:25 [1]NIB1_MSC.0.0.3.0 Communications Alarm + Minor E1 Port Receive Carrier Loss this output : (?) 2000/06/19 15:22:13 NIB1_BSX Communications Alarm + Critical OMC and equipment 2000/06/19 15:22:15 NIB1_MSC Communications Alarm + Critical OMC and equipment 2000/06/19 16:03:25 [1]NIB1_MSC.0.0.3.0 Communications Alarm + Minor E1 Port Receive C

you can use the substr function

substr($line, 99, 10000000,"");

should do what you want.

#!/usr/bin/perl -w use strict; foreach (<DATA>) { substr($_,99,10000000,""); print "$_\n"; } __DATA__ 2000/06/19 15:22:13 NIB1_BSX Communications Alarm + Critical OMC and equipment Connection broken 2000/06/19 15:22:15 NIB1_MSC Communications Alarm + Critical OMC and equipment Connection broken and up 2000/06/19 16:03:25 [1]NIB1_MSC.0.0.3.0 Communications Alarm + Minor E1 Port Receive Carrier Loss

Comment on Answer: How do I print only some letters of this string
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2015-07-05 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls