spliting a string.

spliting a string.

am 06.04.2008 18:28:31 von deepak

hi everyone,
I'm new to shell script.Any one please clear me the following doubts:

1) Is Shell script executes faster than a perl script?
2) How to split a string with a delimiter(eg. \t) and store in an
array in shell script.
3) How do we execute a mysql query in shell script.

thanx in advance.

Re: spliting a string.

am 06.04.2008 18:48:48 von Johann Kappacher

deepak wrote:

> 1) Is Shell script executes faster than a perl script?
In most cases, perl uses functions instead of calling UNIX utilities.
Shell scripts depend on calling UNIX utilities because of limited
language capabilities. UNIX utilities are separate programs (=processes)
that need some time to start.

> 2) How to split a string with a delimiter(eg. \t) and store in an
> array in shell script.
This is simple stuff, please read a beginner's tutorial. You will see
enough examples. btw: String and Array manipulation is the domain of Perl.

> 3) How do we execute a mysql query in shell script.
Use mysql as a commandline utility (inside shell scripts) or use perl
-MDBD::mysql (DBI and DBD must be compiled/installed before).

--jk

Re: spliting a string.

am 07.04.2008 08:52:27 von deepak

thanks jk

Re: spliting a string.

am 07.04.2008 23:23:18 von Johann Kappacher

deepak wrote:
> thanks jk
This may be a starting point for you:
http://tldp.org/LDP/abs/html/arrays.html

The whole bash tutorial:
http://tldp.org/LDP/abs/html/index.html

Search for a "Learning bash" or so book.