OK so I've inherited a set of scripts that do some work on a database. They do all have a standard comment block at the beginning that has good information on the script. I would like to generate a quick web page report that lists the script name and the description lines (for now it may be expanded in the future).
For reasons that aren't worth getting into the script that is making the page has to be a perl script.
The comment block format is as follows.
Now I don't have problems writing the HTML from perl, and quick my @list = `ls $search_dir`; gets me the names.
And not all parts of that block are in every file. Some don't have any Table or Mode or Function sections so I don't always have a standard place to end my parsing.
I've managed to use sed (and I admit I'm really not good with sed or many other standard *nix tools) to pull just the line with Description but if it's multi line or the description starts on the next line I'm not getting things to work right.
The snipet that is working for the single line (and yes this parses subdirectories and creates links for the scripts as I will want that for some but for now am just doing it for everything) is as follows
Which of course would work if the description were always a single line preceded by the # Description comment tag.
Since you are using Perl and I don't know much sed, here's some perl to extract the description.
I guess your biggest problem will be identifying where the description ends. In the following I have put that task into a subroutine so that it can be easily modified and
for starters I assume that a line with only a # on it ends the description.
I'm scanning a list of emails- I need to pull 2 pieces of data, then move to the next file:
Sender's Email Address
Email Date
I need these to be outputted into a single column- separated by a ",". Like this:
Email1's Address, Email1's Date Stamp
Email2's Address, Email2's Date Stamp... (4 Replies)
Hello, fellow computer junkies. First time poster! My boss wrote an application (Mavericks 10.9, Mountain Lion 10.8) that checks a user's security settings. The user runs the application, then it spits out an email that is sent back to our inbox showing the results. On our end, we have a mail rule... (5 Replies)
Hi there, Please could anyone help with this.
I have an xml file that contains repeating values eg
<Rule name> AAAAA
<Action> BBBBB
</Action>
<Data> CCCCC
</Data>
<Type> DDDDD
</Type>
</Rule name>
<Rule name> A1A1A1A1
<Action> B1B1B1B1
</Action>
<Data> C1C1C1C
</Data>
<Type>... (4 Replies)
Hi there,
I'm having a problem trying to extract data from within a text file. I'm trying to extract this manually for a lack of better words.
I need any items that fall within latitude 36.5 to 39.5 and long -75.3 to -83.9
I have been doing this using cat neta.txt | grep '!38' and working... (6 Replies)
Good day Gurus,
I have a csv file that contains an inventory of active servers. This csv file contains a well over a hundred systems (IBM, SUN, HP). It also contains those systems details. See below for an example
hostA,invver,1.02,20100430
hostA,date,08/30/2010,06:18
hostA,use,"Unknown... (4 Replies)
Hi all,
I have the following script, but are not too sure about the syntax to complete the script.
In essence, the script must connect to a SFTP server at a client site with username and password located in a file on my server.
Then change to the appropriate directory.
Pull the data to the... (1 Reply)
I saw a few posts close to what i want to do, but they didn't look like they would work exactly.. or I need to think out of the box on this.
I have a file that I keep server stats in for my own performance analysis. this file has the output from many commands in it (uptime, vmstats, ps, swap... (2 Replies)