Is there a way to do this

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
prabhu_kar
Posts: 4
Joined: Wed Aug 27, 2008 12:51 pm

Is there a way to do this

Post by prabhu_kar »

Hey ,

Was wondering if it is possible at all to do the following

Input

LT.txt(829): Url: https://www.LT.com/bptraderep/tradeRepo ... d_on_r.gif
LT.txt(832): Transaction time: 0.049 seconds
LT.txt(833): Time to first byte: 0.048 seconds
LT.txt(861): Url: https://www.LT.com/bptraderep/JSX/js/ie7/jsx.js
LT.txt(864): Transaction time: 0.305 seconds
LT.txt(865): Time to first byte: 0.045 seconds
LT.txt(892): Url: https://www.LT.com/bptraderep/JSX/css/ie/JSX.css
LT.txt(895): Transaction time: 0.014 seconds
LT.txt(896): Time to first byte: 0.012 seconds
LT.txt(923): Url: https://www.LT.com/bptraderep/JSX/images/spc.gif
LT.txt(926): Transaction time: 0.046 seconds
LT.txt(927): Time to first byte: 0.045 seconds


Output

https://www.LT.com/bptraderep/tradeRepo ... d_on_r.gif, Transaction time: 0.049 seconds,Time to first byte: 0.048 seconds
https://www.LT.com/bptraderep/JSX/js/ie7/jsx.js, Transaction time: 0.305 seconds,Time to first byte: 0.045 seconds
..
..
..



It sounds wierd, but I need to collate a huge file from probably a lot of test cases.I can still do kind of a workaround in EXCEL but would be great I can do it from Textpad


Appreciate any help ... :roll:

Thanks
PS
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

So if I'm reading your request correctly, the pattern looks like
Url: Something
Line 2 data
Line 3 data

and you want it to be
Something, Line 2 data, Line 3 data

A macro would work for this but as a regular expression, assuming POSIX regular expressions are used, something like

Search for: Url: (.*)\n(.*)\n(.*)\n
Replace with: \1,\2,\3

If the file names and line numbers are actually preceding it, then the expression could be

Search for: .*: Url: (.*)\n.*\): (.*)\n.*\): (.*)
Replace with: \1,\2,\3
I choose to fight with a sack of angry cats.
prabhu_kar
Posts: 4
Joined: Wed Aug 27, 2008 12:51 pm

Thank You Very Much ..that saved a lot of work for me .....

Post by prabhu_kar »

The final string was kind of like this ,

Url: (.*)\n.*\Transaction time: (.*) seconds\n.*\Time to first byte: (.*) seconds\n


I needed to pull out the data I need and move it to Excel This works like a charm


Thanks for showing how to do it ... :D

Thanks
Prabhu
Post Reply