LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] bind + lex + yacc...

[ILUG] bind + lex + yacc...

Matthew French mfrench42 at yahoo.co.uk
Tue Jul 23 17:19:05 IST 2002


Paul Jakma owned up:
> right... the person kevin is poking fun at is me.
>
> secondly: i mailed him about lex + yacc being very cute tools.
>
> thirdly: to illustrate i gave lex + yacc examples (slightly extended
> versions of examples from a HOWTO on the net) to parse, eg:

Just an example, the way I typically generate files is to use a bash script,
something like:
------------------------------------------
# Output functions
do_header()
{
   cat <<EOF
// Start of config
// Generated: $now
// By: $myname
EOF
}

do_item()
{
    echo "  Files in $1: $2"
}

do_footer
{
  echo "// The end"
}

# Do the work
generate()
{
  do_header
  for dir in $*
  do
    do_item "$dir" `ls $dir | wc -l`
  done
  do_footer
}

# Start of script
myname=$0
now=`date`

generate > output.file
------------------------------------------

Obviously one could use perl, python, TCL, Java, C, or whatever. Even PHP
and JSP's if one is ready for creative use of wget. The web option is
actually a better option of the web server is reachable by all domains and
the code changes often enough to make it easier to maintain centrally, and
SSH can be used to distribute the "files" securely.

But bash/ksh/sh is normally the lowest common denominator and so long as one
is careful to avoid cross platform differences, this will implement the
required functionality without having other external dependencies.

HTH,

- Matthew

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.comm





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell