pls help me in solving two problems
pls help me in solving two problems
am 02.07.2006 07:22:10 von ashish.sachan
Hi i m just starign with PERL..given two problems to solve ..pls help
me in solving them
1. Develop a shell and a perl script to run on a Linux machine. The
script should
take a quoted string as one required argument and one more optional
argument as
a starting directory. Default starting directory will be "/" (the
root directory in
Linux) if the second argument is not provided to the script. The script
should
recursively go through all files under the directory, check the type of
file, and
only for files that are not directories or binary files, search the
file contents for the
quoted string (first argument to the script). The script should print
the "relative"
path of the files (relative to the directory - second argument or
default) in which
the string specified in the first argument is found.
2. Develop a shell and a perl script to print the process-id tree. The
script should take
one numeric value as argument. For example, if the script is run with
argument
12345, then the output should be a complete process tree showing the
process
having PID of 12345, its parent, grandparent, ... and also its child,
grandchild, ...
The output must show the PID, PPID and process name of each process in
the
process tree. Indented output for better readability is desired
Re: pls help me in solving two problems
am 02.07.2006 23:18:45 von Joe Smith
ashish.sachan@gmail.com wrote:
> Hi i m just starign with PERL..given two problems to solve
Your "problems" sound suspiciously like homework assignments.
Re: pls help me in solving two problems
am 04.07.2006 15:45:21 von Yogesh Sawant
Joe Smith wrote:
> ashish.sachan@gmail.com wrote:
> > Hi i m just starign with PERL..given two problems to solve
>
> Your "problems" sound suspiciously like homework assignments.
Also, the chap cross posted in six groups.
Nobody does his homework.
Re: pls help me in solving two problems
am 08.07.2006 17:25:19 von Randy Latimer
ashish.sachan@gmail.com wrote:
> Hi i m just starign with PERL..given two problems to solve ..pls help
> me in solving them
>
Unix 'find' will work very well for the first problem. Why reinvent the
wheel?
> 1. Develop a shell and a perl script to run on a Linux machine. The
> script should
> take a quoted string as one required argument and one more optional
> argument as
> a starting directory. Default starting directory will be "/" (the
> root directory in
> Linux) if the second argument is not provided to the script. The script
> should
> recursively go through all files under the directory, check the type of
> file, and
> only for files that are not directories or binary files, search the
> file contents for the
> quoted string (first argument to the script). The script should print
> the "relative"
> path of the files (relative to the directory - second argument or
> default) in which
> the string specified in the first argument is found.
>
> 2. Develop a shell and a perl script to print the process-id tree. The
> script should take
> one numeric value as argument. For example, if the script is run with
> argument
> 12345, then the output should be a complete process tree showing the
> process
> having PID of 12345, its parent, grandparent, ... and also its child,
> grandchild, ...
> The output must show the PID, PPID and process name of each process in
> the
> process tree. Indented output for better readability is desired
>
Re: pls help me in solving two problems
am 30.09.2006 14:32:38 von Olivier Mougin
ashish.sachan@gmail.com a écrit :
> Hi i m just starign with PERL..given two problems to solve ..pls help
> me in solving them
>
> 1. Develop a shell and a perl script to run on a Linux machine. The
> script should
> take a quoted string as one required argument and one more optional
> argument as
> a starting directory. Default starting directory will be "/" (the
> root directory in
> Linux) if the second argument is not provided to the script. The script
> should
> recursively go through all files under the directory, check the type of
> file, and
> only for files that are not directories or binary files, search the
> file contents for the
> quoted string (first argument to the script). The script should print
> the "relative"
> path of the files (relative to the directory - second argument or
> default) in which
> the string specified in the first argument is found.
>
> 2. Develop a shell and a perl script to print the process-id tree. The
> script should take
> one numeric value as argument. For example, if the script is run with
> argument
> 12345, then the output should be a complete process tree showing the
> process
> having PID of 12345, its parent, grandparent, ... and also its child,
> grandchild, ...
> The output must show the PID, PPID and process name of each process in
> the
> process tree. Indented output for better readability is desired
>
find command in unix or linux works well.
for perl you can search a file::find package and some modules like
File::Copy, perform a search on the web by google or oreilly web site.
Better to do it on your own ..
Good luck
Olive