[ale] [OT] sed/php/bash-script programming question

Jonathan Glass (IBB) jonathan.glass at ibb.gatech.edu
Mon Oct 28 20:16:46 EST 2002


There aren't any write-in places available.  The students have the
ballots 2 days ahead of time, and can register to be on the ballot up
until then.  

I guess I could add an entry to filter for input type=text....

Hmm.

Jonathan Glass
RHCE, A+, Network+, Linux+, MCP
478-474-2417
478-737-7742



-----Original Message-----
From: Adrin [mailto:haswes at mindspring.com] 
To: ale at ale.org
Sent: Monday, October 28, 2002 7:56 PM
To: jonathan glass (ibb); ale at ale.org
Subject: RE: [ale] [OT] sed/php/bash-script programming question


Now how do you account for a write in?


> -----Original Message-----
> From: jonathan glass (ibb) [mailto:jonathan.glass at ibb.gatech.edu]
> Sent: Sunday, October 27, 2002 8:13 PM
> To: ale at ale.org
> Subject: Re: [ale] [OT] sed/php/bash-script programming question
> 
> 
> Dangit!  Why do I always find the solution 2 minutes after I ask for 
> help. This does the trick.
> 
> sed '$s/,//g' /tmp/vote-array-final.tmp
> 
> Thanks anyway...
> 
> Jonathan
> 
> On Sun, 2002-10-27 at 19:57, jonathan glass (ibb) wrote:
> > In a perfect world, yep...but this is reality and the ballots are 
> > controlled by students, so nope.  That uniq command did the trick. 
> > Thank you.
> > 
> > One more questions for the experts here:
> > 
> > I have modified the script, and now it creates the MySQL tables 
> > correctly (thanks to Danny Cox)...but the PHP Array portion has an 
> > extra comma, and I cannot figure out how to strip out ONLY the last 
> > comma of a text file.  I've been tinkering with sed, and the man 
> > pages say to use "$", but I cannot get it to work!  Every time I 
> > try, I end up removing ALL the commas! (sed  $s/","/g 
> > /tmp/vote-array.tmp) ARGH!  Any tips? Here is a sample of my output.

> > I output each section (GK,GH,PI,PK) separately, so I could, in 
> > theory, remote the trailing "," if I could figure out how to replace

> > the last character on the last line.  Any help/thoughts/flames/ideas

> > where in TFM to read?
> > 
> > $VOTE_POST_ARRAYS = array (
> > "GK" => array (
> > "required_src_sec"=>"20",
> > "required_gk_crc1"=>"20",
> > "required_gk_crc2"=>"20",
> > "required_gk_crc3"=>"20",
> > "required_gk_cab"=>"20",
> > "required_male_vis"=>"20",
> > ),
> > "GH" => array (
> > "required_sga_pol"=>"20",
> > "required_src_sec"=>"20",
> > "required_gh_vp"=>"20",
> > "required_gh_sec"=>"20",
> > "required_gh_cja"=>"20",
> > "required_gh_sga"=>"20",
> > "required_gh_cab"=>"20",
> > "required_male_vis"=>"20",
> > ),
> > "PK" => array (
> > "required_pk_vp"=>"20",
> > "required_pk_trs"=>"20",
> > "required_pk_sec"=>"20",
> > "required_pk_cja1"=>"20",
> > "required_pk_cja2"=>"20",
> > "required_pk_cja3"=>"20",
> > "required_pk_cja4"=>"20",
> > "required_pk_cja5"=>"20",
> > "required_pk_cja6"=>"20",
> > "required_pk_cja7"=>"20",
> > "required_pk_sga1"=>"20",
> > "required_pk_sga2"=>"20",
> > "required_pk_sga3"=>"20",
> > "required_pk_sga4"=>"20",
> > "required_pk_sga5"=>"20",
> > "required_pk_sga6"=>"20",
> > "required_pk_sga7"=>"20",
> > ),
> > "PI" => array (
> > "required_pir_sga"=>"20",
> > ));
> > ~
> > 
> > Thanks
> > 
> > Jonathan Glass
> > 
> > On Sun, 2002-10-27 at 14:02, Danny Cox wrote:
> > > Jonathan,
> > > 
> > > On Sun, 2002-10-27 at 11:07, jonathan glass (ibb) wrote:
> > > > echo "CREATE TABLE GKVoteRESULTS ("
> > > > grep "<input" ballot.html \
> > > > | sed s/"[<|>]"//g \
> > > > | sed s/"^ *input "//g \
> > > > | sed s/"type=radio "//g\
> > > > | sed s/"value=[a-z ]* "//g \
> > > > | sed s/"name="//g \
> > > > | sed s/"$"/" varchar(20) NOT NULL,"/g
> > > 
> > >   | uniq
> > > 
> > > > echo "id int(5) NOT NULL auto_increment,
> > > > time timestamp(14) NOT NULL,
> > > > PRIMARY KEY  (id)
> > > > )"
> > > 
> > > 	At first blush, this ought to do it....  Can you be sure that
the 
> > > dups will always be be together?
> > > 
> > > --
> > > kernel, n.: A part of an operating system that preserves the
> > > medieval traditions of sorcery and black art.
> > > 
> > > Danny
> > 
> > 
> > 
> > ---
> > This message has been sent through the ALE general discussion list. 
> > See http://www.ale.org/mailing-lists.shtml for more info. Problems 
> > should be sent to listmaster at ale dot org.
> 
> 
> 
> ---
> This message has been sent through the ALE general discussion list. 
> See http://www.ale.org/mailing-lists.shtml for more info. Problems 
> should be sent to listmaster at ale dot org.
> 


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list