You are here: PSPad forum > English discussion forum > Search/Replace-airline timetable project(long)

Search/Replace-airline timetable project(long)

#1 Search/Replace-airline timetable project(long)

Posted by: skyman | Date: 2010-01-17 20:13 | IP: IP Logged

Pretty much a novice using text editors but I am trying to create(real-time)flight plans for Microsoft Flight Simulator using available airline PDF timetables...which of course you can downloaded from most airline's websites.

Using basic regular expressions/other I am able to(after copy/paste to a .txt from said pdf)move data around into a format that is eventually(other steps involved)readable by a program that was created to make the flight plans usable by Flight Simulator.

With little knowledge of expressions/scripts/etc. I'm sure I do things the long way(mostly the wrong way sad smiley). One of the many short comings of this is it makes it virtually impossible to edit flight data from the "major" airlines...which have 100's of flights and thus their timetables contain over a thousand lines of data that need edited in one way or another.

Without knowing shortcuts/etc. it makes(sometimes)line by line edits very time consuming.

To give you an example of a typical timetable project I am currently working on..Midwest Airlines...the following data(below)is an excerpt from the data obtained using cut/paste from their PDF timetable.

Unfortunately, using the basic version of FOXIT reader for reading PDF's I am not able to get a clean text version of the PDF with the simple "copy-all/paste" feature...and thus some spaces are omitted...giving me the problem of having to edit those spaces back in.

So, for this particular airlines timetable the first step is to look for a shortcut to separate(by a space) the information that was bunched together...

From...

06350740YX6028G CRJ12345671:05
11451246YX6002G CRJ12345.71:01
13351434YX6009G CRJ12345670:59
etc.

To...

0635 0740 YX6028G CRJ 1234567 1:05
1145 1246 YX6002G CRJ 12345.7 1:01
1335 1434 YX6009G CRJ 1234567 0:59
etc.

Not sure of the limitations of text editors like PSPad in regards to this project. But being able to simplify the process...in any way...will be greatly appreciated.

Again...sorry for the long first post.

Options: Reply | Quote | Up ^


#2 Re: Search/Replace-airline timetable project(long)

Posted by: pspad | Date: 2010-01-17 20:21 | IP: IP Logged

Search: (.{4})(.{4})(.{7})(.{3})(.{7})(.{4,5})
Replace: $1 $2 $3 $4 $5 $6
[x]Regular expression

Options: Reply | Quote | Up ^


#3 Re: Search/Replace-airline timetable project(long)

Posted by: vbr | Date: 2010-01-17 21:37 | IP: IP Logged

skyman:
...
Using basic regular expressions/other I am able to(after copy/paste to a .txt from said pdf)move data around into a format that is eventually(other steps involved)readable by a program that was created to make the flight plans usable by Flight Simulator.

With little knowledge of expressions/scripts/etc. I'm sure I do things the long way(mostly the wrong way sad smiley). ...

Hi,
if the editing process involves multiple steps, but you are still able to formulate them as replacement patterns,
you can try to adapt the script I posted some time ago:

forum.pspad.com

You may also use runPSPadAction(...) mentioned later in that thread to call some of the PSPad functions.
Regards,
vbr

Options: Reply | Quote | Up ^


#4 Re: Search/Replace-airline timetable project(long)

Posted by: skyman | Date: 2010-01-17 23:19 | IP: IP Logged

pspad:
Search: (.{4})(.{4})(.{7})(.{3})(.{7})(.{4,5})
Replace: $1 $2 $3 $4 $5 $6
[x]Regular expression

That works great...thank you.

Options: Reply | Quote | Up ^


#5 Re: Search/Replace-airline timetable project(long)

Posted by: skyman | Date: 2010-01-17 23:29 | IP: IP Logged

vbr:
Hi,
if the editing process involves multiple steps, but you are still able to formulate them as replacement patterns,
you can try to adapt the script I posted some time ago:

forum.pspad.com

You may also use runPSPadAction(...) mentioned later in that thread to call some of the PSPad functions.
Regards,
vbr

Ideally, because the airlines tend to change their timetables every couple of months or so, it would be nice to develop a script to do multiple functions(assuming they do not change their timetable structure). They would have to be unique to each airlines timetable structure...even though most follow a basic pattern of flight times/departure airport/arrival airport/aircraft type/days of the week...

Again guys, thanks for the help...it's a bit of a learning curve for an old geezer like me...nothing wrong with a little challenge I suppose.smiling smiley

Options: Reply | Quote | Up ^


#6 Re: Search/Replace-airline timetable project(long)

Posted by: skyman | Date: 2010-01-20 06:59 | IP: IP Logged

A couple more questions if I might.

I've just about completed the editing of this timetable(American Airlines)...all that's left to do is to add a space(actually a comma)in front of all lines which only contain 1 (ABC)

(ACA),(ORD),2:25p,6:45p,AA2520,738,6
(DFW),2:45p,5:45p,AA2264,M80,X2

In this example I need to put a comma before (DFW)(and multiple other lines with only a single (XXX))....without putting a comma before (ACA),(ORD)(and others with 2).

I'll be working on a script to remove all those flights listed on the timetable that must be removed in order for an accurate flight plan set...those flights which must be removed include all that are NOT non-stops, flights which are either Effective or Discontinued by a date specified, codeshare flights, etc.

That's one of the most time consuming parts of this project...but obviously not removing that data can really mess things up when you compile all the flight segments.

The above example is pretty much what I end up with when finished with a timetable. I then copy the data and create a .csv(Excel)which allows me to move columns around to get the final format to create my flight plans for Flight Simulator(using the program to compile the data I mentioned in my original post).

That format is basically...

Flight#;Dep.(airport);Arr.(airport);Dep(time);Arr(time);days of the week flown;aircraft type

or (using example above for those particular flight segments)

2520;ACA;ORD;2:25pm;6:45pm;6;738
2264;ACA;DFW;2:45pm,5:45pm;134567;M80

Edited 1 time(s). Last edit at 2010-01-20 07:01 by skyman.

Options: Reply | Quote | Up ^


#7 Re: Search/Replace-airline timetable project(long)

Posted by: pspad | Date: 2010-01-20 07:10 | IP: IP Logged

Please put original lines and lines you need

Options: Reply | Quote | Up ^


#8 Re: Search/Replace-airline timetable project(long)

Posted by: skyman | Date: 2010-01-20 18:57 | IP: IP Logged

(ACA),(ORD),2:25p,6:45p,AA2520,738,6
(DFW),2:45p,5:45p,AA2264,M80,X2

to

(ACA),(ORD),2:25p,6:45p,AA2520,738,6
,(DFW),2:45p,5:45p,AA2264,M80,X2

I came up with...

^(\(...\),\d)
,$1

it worked fine

Options: Reply | Quote | Up ^


#9 Re: Search/Replace-airline timetable project(long)

Posted by: skyman | Date: 2010-02-02 00:29 | IP: IP Logged

Got another one smiling smiley
Continental Airlines uses the following to designate days of the week used for particular flights. Like this....

S------
-------
-------
-------
-----TF
-------
S--T---
-SM----
----W--
-------

The format is basically SSMTWTF which I need to change to #'s instead for the days of the week....SSMTWTF to 6712345(Sat, Sun, Mon, Tue, Wed. Thu, Fri)

...so I need to change the above example to...

6------
-------
-------
-------
-----45
-------
6--2---
-71----
----5--
-------

if possible...

Thanks

Options: Reply | Quote | Up ^


#10 Re: Search/Replace-airline timetable project(long)

Posted by: crm | Date: 2012-09-28 21:23 | IP: IP Logged

Yo lo haría que hacerlo en varios pasos:

Buscar : S(.)(.)(.)(.)(.)(.)
Reemplazar: 6$1$2$3$4$5$6

Buscar : (.)S(.)(.)(.)(.)(.)
Reemplazar: $1z$2$3$4$5$6

Buscar : z
Reemplazar: 7

Buscar : (.)(.)M(.)(.)(.)(.)
Reemplazar: $1$2z$3$4$5$6

Buscar : z
Reemplazar: 1

Buscar : (.)(.)(.)T(.)(.)(.)
Reemplazar: $1$2$3z$4$5$6

Buscar : z
Reemplazar: 2

Buscar : (.)(.)(.)(.)W(.)(.)
Reemplazar: $1$2$3$4z$5$6

Buscar : z
Reemplazar: 3

Buscar : (.)(.)(.)(.)(.)T(.)
Reemplazar: $1$2$3$4$5z$6

Buscar : z
Reemplazar: 4

Buscar : (.)(.)(.)(.)(.)(.)F
Reemplazar: $1$2$3$4$5$6z

Buscar : z
Reemplazar: 5

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR