#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my $printed; while (<>) { chomp; if (/^&LOG[ ]TEXT:[ ] " # The opening quote. [^"]*\\ # Path up to the last backslash. ( [^\\"]+ ) # The final part of the path. " # The closing quote. $/x ) { print "\n" if $printed++; say "[$1]"; } elsif (m{^&LOG[ ]Naming_Technique:[ ] [^@]+\@ # Anything up to the @. \w+/ # Word characters followed by a slash. ([^/]+)/ # The part_no. ([^/]+) # the part_rev. $}x ) { say "db_part_no=$1"; say "db_part_rev=$2"; } } #### perl create-ini.pl input-file > output-file.ini