Python Forum
Extract a string between 2 words from a text file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extract a string between 2 words from a text file
#1
Hi Forum,

I have a very long Code script containing SAS Proc SQL. There's a lot of excess code that I don't need and I know that the individual scripts will begin with 'proc sql' and end with 'quit;'.

I've read up and tried a few things but can't get any useful results.

Can anyone give me an idea of a Python3 script that would output a list the individual scripts using a .txt file?

Thanks Peter
Reply


Messages In This Thread
Extract a string between 2 words from a text file - by OscarBoots - Nov-01-2021, 06:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  extract substring from a string before a word !! evilcode1 3 533 Nov-08-2023, 12:18 AM
Last Post: evilcode1
  Need to replace a string with a file (HTML file) tester_V 1 762 Aug-30-2023, 03:42 AM
Last Post: Larz60+
  Form that puts diacritics on the words in the text Melcu54 13 1,466 Aug-22-2023, 07:07 AM
Last Post: Pedroski55
Sad How to split a String from Text Input into 40 char chunks? lastyle 7 1,122 Aug-01-2023, 09:36 AM
Last Post: Pedroski55
  Pulling Specifics Words/Numbers from String bigpapa 2 752 May-01-2023, 07:22 PM
Last Post: bigpapa
  Extract file only (without a directory it is in) from ZIPIP tester_V 1 981 Jan-23-2023, 04:56 AM
Last Post: deanhystad
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,114 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  extract only text strip byte array Pir8Radio 7 2,924 Nov-29-2022, 10:24 PM
Last Post: Pir8Radio
  Extract only certain text which are needed Calli 26 5,851 Oct-10-2022, 03:58 PM
Last Post: deanhystad
  How to extract specific data from .SRC (note pad file) Shinny_Shin 2 1,263 Jul-27-2022, 12:31 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020