hiw do i perform this extraction

K

kitcha

i have a file of this format..

ModelGen Info, Time 63425843 ps, Instance Device/Device_core
00000084 E5810000 STR r0,[r1,#0]

i want the script to print an output like this

Time 63425843 ps

00000084 E5810000 STR r0,[r1,#0]


wht cmds shud i use?
 
T

Tad McClellan

kitcha said:
wht cmds shud i use?


-------------------------
#!/usr/bin/perl
use warnings;
use strict;

while ( <DATA> ) {
if ( s/^\s\s+/ / ) {
print;
next;
}
s/^[^,]+,\s*//;
s/,[^,]+$//;
print "$_\n";
}

__DATA__
ModelGen Info, Time 63425843 ps, Instance Device/Device_core
00000084 E5810000 STR r0,[r1,#0]
 
R

RedGrittyBrick

kitcha said:
i have a file of this format..

ModelGen Info, Time 63425843 ps, Instance Device/Device_core
00000084 E5810000 STR r0,[r1,#0]

i want the script to print an output like this

Time 63425843 ps

00000084 E5810000 STR r0,[r1,#0]


wht cmds shud i use?

I thk ul hv mr lck f u us ths 1s:

/!perl
use strict;
use warnings;
while (<$posting>) {
s/wht/what/;
s/cmds/commands/;
s/shud/should/;
s/i/I/;
print;
}

bcz ts hrd 2 tl wt ppl rly mn whn ty us txt spk on usnt so i wdnt rcmnd t.
 
J

John W. Krahn

kitcha said:
[ snip multiposted message ]

This message has been posted more than once as separate articles:
comp.lang.perl.misc
<
perl.beginners
<

This practice, known as multiposting, is generally considered
impolite in Usenet newsgroups. For an explanation, please see:

http://www.cs.tut.fi/~jkorpela/usenet/xpost.html

*THIS* message has been posted more than once as separate articles:

comp.lang.perl.misc
<
comp.lang.perl.misc
<

This practice, known as multiposting, is pissing some of us off.
 
C

Charlton Wilbur

John W. Krahn said:
*THIS* message has been posted more than once as separate articles:

comp.lang.perl.misc
<
comp.lang.perl.misc
<

This practice, known as multiposting, is pissing some of us off.

ESPECIALLY as some of us have filtered out the offending multiposts in
the first place -- now we also need to filter out the multiposted
messages nagging the newsgroup at large about multiposting?

Charlton
 
U

usenet

John said:
This practice, known as multiposting, is pissing some of us off.

Sheesh - I tested this damn thing with over 100 test posts and I never
saw this.

OK, OK - I'm turning off the bot. I gotta figure out how to do
effective "real world" testing without actually posting back to usenet.
Maybe I'll have the bot send me an e-mail or something...
 
D

Dr.Ruud

(e-mail address removed) schreef:
John W. Krahn:

Sheesh - I tested this damn thing with over 100 test posts and I never
saw this.

OK, OK - I'm turning off the bot. I gotta figure out how to do
effective "real world" testing without actually posting back to
usenet. Maybe I'll have the bot send me an e-mail or something...

That is how a bot of mine works: I have to reply to its email before it
posts a message. I wrote it quite a while ago, in procmail+sed, and it
is still operational (look for "newszilla-pmf" in google-groups for
details), but is hardly ever used, because newszilla is just too good.

I included in the source a way to skip the approval-by-email, but I
never activated that, because that would open a spam-path (from a
webpage almost directly to usenet). The bot can easily be adjusted to
send the moderation email to multiple addresses, so more than just me
can be involved in the approval/rejection procedure. In short, it is a
moderated bot, and it transforms data coming from a web-form into a
usenet posting.

(It doesn't really solve a problem, I wrote it mainly to show that it
could be done with what is available to an average client of my ISP.)
 
K

kitcha

Hi Tad ,
Thanks for the script but it has some issues

I have a 1000 line document like this...


# ModelGen Info, Time 14088224 ps, Instance /tb_device/device_u1/
# 00000098 E88B01FE STMIA r11,{r1-r8}
# ModelGen Info, Time 14318056 ps, Instance /tb_device/device_u1/
# Data Write FFFFFE08
00000010
# ModelGen Info, Time 14344356 ps, Instance /tb_device/device_u1/
# (seq) FFFFFE0C
000000A0
# ModelGen Info, Time 14370656 ps, Instance /tb_device/device_u1/
# (seq) FFFFFE10
00000000
# ModelGen Info, Time 14396956 ps, Instance /tb_device/device_u1/
# (seq) FFFFFE14
00000060
# ModelGen Info, Time 14423256 ps, Instance /tb_device/device_u1/
# (seq) FFFFFE18
00000000
# ModelGen Info, Time 14449556 ps, Instance /tb_device/device_u1/
# (seq) FFFFFE1C
00008050
# ModelGen Info, Time 14475856 ps, Instance /tb_device/device_u1/
# (seq) FFFFFE20
00000080
# ModelGen Info, Time 14502156 ps, Instance /tb_device/device_u1/
# (seq) FFFFFE24
00000020
# ModelGen Info, Time 14509024 ps, Instance /tb_device/device_u1/
# 0000009C E3A01008 MOV r1,#8
# ModelGen Info, Time 14719424 ps, Instance /tb_device/device_u1/
# 000000A0 E3A02E1A MOV r2,#0x1a0
# ModelGen Info, Time 14929824 ps, Instance /tb_device/device_u1/
# 000000A4 E59F303C LDR r3,0xe8
# ModelGen Info, Time 15343756 ps, Instance /tb_device/device_u1/
# Data Read 000000E8
FFFFFE00
# ModelGen Info, Time 15363774 ps, Instance /tb_device/device_u1/
# 000000A8 E8830006 STMIA r3,{r1,r2}
# ModelGen Info, Time 15593606 ps, Instance /tb_device/device_u1/
# Data Write FFFFFE00
00000008


the problem is that all the characters that come after {} rnt
printed...it would be thankful if u cud explain the script to me as i m
not able to understand it..

thanks and regards,
kitcha
 
T

Tad McClellan

kitcha said:


Do not send stealth-Cc emails. It is rude.

Thanks for the script but it has some issues


It works perfectly for the data that you gave me.

I have a 1000 line document like this...


If you change the specification, then the solution is likely to change!

the problem is that all the characters that come after {} rnt
printed...


The problem was that you gave virtually no specification for
what you wanted.

My program does exactly what you asked for.

If you want something else, then specify something else.

it would be thankful if u cud explain the script to me as i m


It is spelled "you", not "u".

It is spelled "could", not "cud".

It is spelled "am", not "m".

Do not use "cutsie" spellings, it is rude to people for whom
English is not a first language.

not able to understand it..


Programs are much easier to understand if you write them yourself.

Try that first, then post here if you get stuck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top