[Gllug] jobserve perl script
Steven M. Castellotti
scastell at sas.upenn.edu
Mon Jul 30 18:22:22 UTC 2001
I don't have a perl script, but I have a python script that I use to
parse out specific entries (in my case, I can't apply to ASAP notices
since I won't be moving to London until October)
Here you go:
Darren Evans wrote:
>
> Has anyone got a perl script that parses the output?
>
> I've half wrote something, but am not happy with it.
>
> Darren
>
> --
> Gllug mailing list - Gllug at linux.co.uk
> http://list.ftech.net/mailman/listinfo/gllug
--
Steve Castellotti
Systems Programmer
School of Arts and Sciences, University of Pennsylvania
-------------- next part --------------
#!/usr/bin/env python
#
# Jobserve IT Listing Filter
#
# Copyright Steven M. Castellotti (2001)
# The author can be reached at: SteveC at innocent.com
# This code is released under the GNU Pulic License (GPL) version 2.0
# For more information please refer to http://www.gnu.org/copyleft/gpl.html
#
# Last Update: 2001.07.18
#
# This program will take in a filename (or stdin) of Jobserve IT Listings
# and will output a summary of the jobs which fit my timing requirements
#
# Calling Example:
#
# ./jobserve_filter.py <filename>
#
# cat <filename> | ./jobserve_filter.py
#
#
#####################################################################
import fileinput, string
#####################################################################
# Global Variables
#####################################################################
filters = []
filters.append( "St: ASAP" )
filters.append( "St: Immediate" )
filters.append( "St: Immediately" )
filters.append( "St: Immediate Start" )
filters.append( "St: Not Soon Enough" )
filters.append( "St: ASAP - Candidates Must Be Eligible To Work In The Uk" )
filters.append( "ASAP -candidates Must Be Eligible To Work In The Uk" )
filters.append( "St: ASAP - Interviews Now" )
filters.append( "St: Yesterday" )
filters.append( "St: Urgent Immediate" )
filters.append( "St: Today Or ASAP" )
filters.append( "St: Immediate- ASAP" )
filters.append( "St: Immediate - ASAP" )
filters.append( "St: ASAP - Urgent" )
filters.append( "St: Immedaite" )
entries = []
filtered_entries = []
#####################################################################
# Functions
#####################################################################
def intersection(*args):
result = []
for each in args[0]:
for other in args[1:]:
if each not in other: break
else:
result.append(each)
return(result)
#####################################################################
# Main
#####################################################################
# Parse apart entries based on blank lines
current_entry = ""
for line in fileinput.input():
if line[0:2] != "//": # skip comments
if line != "\n":
current_entry = current_entry + line
elif current_entry != "":
entries.append(current_entry)
current_entry = ""
# Remove the Mail header and first blank entry
del entries[0]
del entries[0]
# Remove trailing information and blank entries
del entries[-1]
del entries[-1]
# Begin filtering
for each in entries:
lines = string.split(each, "\n")
if intersection(filters, lines) == []:
filtered_entries.append( each )
# Print unfiltered entries
for each in filtered_entries:
print "%s" % each
# Print filter statistics
print "Total entries: %i" % len(entries)
print "Total filtered entries: %i" % ( len(entries) - len(filtered_entries) )
print "Remaining unfiltered entries: %i" % len(filtered_entries)
More information about the GLLUG
mailing list