List-Update Script
Every month I receive a spreadsheet with a list of members in a retirees'
organization. I extract the column in the spreadsheet containing the
email addresses to a text file on a PC and then transfer it to a Solaris
server that handles email addressed to the mailing list. I've been manually
processing the text file each month to remove blank email addresses, duplicates,
and invalid email addresses. At lunch today, I wrote a small
BASH script,
list-update
to automate the process.
Since I don't use sed often,
but sometimes need to use it to delete blank lines, such as the many that
occur in the membership list, I thought I would put a note to myself here
on the syntax for the sed command to remove blank lines from a file:
cat filename | sed -e '/^$/d' > newfilename
[/os/unix/programs/utilities]
permanent link
Pcal
If you need to generate a calendar in
HTML,
Pcal will allow
you do generate one. To generate an HTML file you specify
the
-H parameter. You specify the output file
with the
-o parameter. Otherwise output will
go to standard output, e.g. the screen. You can specify
that a calendar be created for an entire year by putting
a two digit representation of the year at the end of the
command line. You can specify text to be used for both
the title of the webpage, i.e. what you commonly see in the top
line of your browser, and for the webpage heading by using
the
-C parameter. E.g. to create a file /tmp/mycalendar.html
for 2006 with a title and heading of "My 2006 Calendar", you
could use the command below. Remember, the case of the letters
you use for the parameter is significant. A
-O
is not the same as a
-o.
pcal -H -o /tmp/mycalendar.html -C "2006 Calendar" 06
2006 Calendar
created by the above command. The program can also produce postscript
output.
If a file exists by that name in the specified directory,
it will be overwritten. I've created a simple
BASH
script,
generate-calendar, that takes 3 parameters, two of
which are optional, that will check if the output file exists.
If it does, it will prompt as to whether it should be overwritten.
Usage: generate-calendar -o output_file [-t title] [-y yy]
The script takes optional title and year arguments
-o specifies the HTML output file, e.g. /example/index.html
-t specifies the title and heading for the HTML file
If there is a space in the title enclose it in double quotes
-y specifies the year for the calendar, e.g. 06
If no year is specified, the calendar will be created only
for the current month
A companion program for pcal is
Lcal, which generates a graphical "lunar phase" calendar for an entire
year.
[/os/unix/programs/utilities]
permanent link