Disclaimer: I'm new to perl scripting, this is partly a training exercise (but still a project to work with). In addition, I have a much stronger understanding of shell scripts, so my examples will most likely be formatted in this way of thinking (but I would like to create them in perl). Sorry in advance for my verbosity, I want to make sure that I am at least very clear in order to understand my point of view.
I have a text file (reference guide) which is a Word document converted to text and then replaced from Windows to UNIX format in Notepad ++. The file is homogeneous, since each section of the file has the same fields / formatting / tables.
What I intended to do in the main way was to capture each section using unique batch job names and put all the values in the database (or maybe just an excel file) so that all fields could be searched / edited for each job much easier than in a word file, and maybe later create a web interface.
So what I want to do is grab each section by doing something like:
sed -n '/job_name_1_regex/,/job_name_2_regex/' file.txt- how will it be formatted in a perl script?
(grab the plot as a whole, then tear it further)
To read the file in a script I have open FORMAT_FILE, 'test_format.txt';, and then use foreach $line (<FORMAT_FILE>)to parse the file line by line. - Is there a better way?
My next problem is that since I converted from the word doc to tables, it looks like this:
Table Heading 1 Table Heading 2
Heading 1/Value 1 Heading 2/Value 1
Heading 1/Value 2 Heading 2/Value 2
:
Table Heading 1
Table Heading 2
Heading 1/Value 1
Heading 1/Value 2
Heading 2/Value 1
Heading 2/Value 2
, " 1" " 2" . , . 1 1 2 ( 1, 2, 1). , awk/sed , , perl script.
--- EDIT ---
:
my @heading1 = ($value1, $value2, etc.)
my @heading2 = ($value1, $value2, etc.)
. , 1 = 2 ( ).
( ):
x=$(cat file.txt | grep -n "Heading 1" | cut -d":" -f1) - , " 1"
(( x = x+2 )) - 2 ( )
sed -n "$x,$last_line_of_values p" file.txt - file.txt , ( - )
- , , ... , ...
---/---
, .., , , perl .
, ... .