Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code for eliminating specific lines in Words Document
#1
Hallo QuickMacros Friends.

I would be delighted if I could get the code for eliminating unwanted data lines from Words document. Here below is a practical exemple of what I'm looking to achieve with QuickMacro:

First the present situation:

(Dim) 4- 1-1970 9:18 Terre (Can) Qti (Vie) Pluton
(Mer) 14- 1-1970 7:11 Terre (Can) Car (Bal) Jupiter
(Ven) 16- 1-1970 5:37 Terre (Can) Sex (Vie) Pluton
(Sam) 31- 1-1970 1:52 Terre (Lio) SCa (Vie) Pluton
(Lun) 2- 2-1970 10:17 Terre (Lio) Qti (Bal) Jupiter
(Lun) 9- 2-1970 0:10 Terre (Lio) SQt (Vie) Pluton
(Mer) 11- 2-1970 11:14 Jupiter (Bal) SSx (Vie) Pluton
(Sam) 14- 2-1970 23:26 Terre (Lio) SSx (Vie) Pluton
(Dim) 15- 2-1970 5:42 Terre (Lio) Sex (Bal) Jupiter
(Mar) 3- 3-1970 8:37 Terre (Vie) SCa (Bal) Jupiter
(Ven) 13- 3-1970 2:15 Terre (Vie) SQt (Bal) Jupiter
(Mar) 17- 3-1970 1:43 Terre (Vie) Con (Vie) Pluton
(Jeu) 19- 3-1970 14:48 Terre (Vie) SSx (Bal) Jupiter
(Jeu) 16- 4-1970 16:02 Terre (Bal) SSx (Vie) Pluton
(Mar) 21- 4-1970 15:07 Terre (Sco) Con (Sco) Jupiter
(Mer) 22- 4-1970 20:30 Terre (Sco) SQt (Vie) Pluton
(Sam) 2- 5-1970 4:04 Terre (Sco) SCa (Vie) Pluton
(Ven) 8- 5-1970 15:13 Jupiter (Sco) SQt (Vie) Pluton


And now the desired result where all the unwanted data is eliminated:


(Mer) 11- 2-1970 11:14 Jupiter (Bal) SSx (Vie) Pluton
(Ven) 8- 5-1970 15:13 Jupiter (Sco) SQt (Vie) Pluton

Thank You very much.

Best Regards.

Silvano Tironi
#2
Select the text and run the following macro. This macro gets selected text, eliminates lines without "Jupiter", and pastes back.

Code:
Copy      Help
[color=blue]str [/color]s.getsel ss
ARRAY([color=blue]str[/color]) a
[color=blue]if[/color]([color=blue]findrx[/color](s "(?m)^\(\w+\)[ \d\-:]+Jupiter.+$" 0 13 a)<0) [color=blue]ret[/color]
[color=blue]int [/color]i
[color=blue]for [/color]i 0 a.len
,ss.formata("%s[]" a[0 i])
ss.setsel
#3
Thank You very much, mission accomplished !

Best Regards

Silvano Tironi


Forum Jump:


Users browsing this thread: 1 Guest(s)