Unix Programming - Version Check using Korne Shell...

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2007 > Version Check using Korne Shell...





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Version Check using Korne Shell...
kirankumar.techy@gmail.com

2007-12-14, 7:37 am

Hi,

I am very new to Korne Shell Scripting. I have a bit complicated
issue :-

I want to add a configuration file, named CONF_FILE in the
directory /
home/stat/temp. This file contains the list of file type which must
begin with a version header (in the form ##vx.y## on the first line).
The format of this configuration file is simply one file type per
line. The type of file which needs a version header are XY, XYY.
For each type of file configured in CONF_FILE, I need to verify to
check if there is a version number and if there is not, I have to
consider it as not OK (KO) .

Request you to pls let me know your inputs.

Thanks a lot in advance.


Barry Margolin

2007-12-15, 1:41 am

In article
<f38ec876-4a71-4429-8765-d3eef564e55b@b40g2000prf.googlegroups.com>,
kirankumar.techy@gmail.com wrote:

> I am very new to Korne Shell Scripting.


If you're going to keep asking questions like these, please get the name
right. It's Korn Shell, not Korne Shell.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Barry Margolin

2007-12-15, 1:41 am

In article
<f38ec876-4a71-4429-8765-d3eef564e55b@b40g2000prf.googlegroups.com>,
kirankumar.techy@gmail.com wrote:

> Hi,
>
> I am very new to Korne Shell Scripting. I have a bit complicated
> issue :-
>
> I want to add a configuration file, named CONF_FILE in the
> directory /
> home/stat/temp. This file contains the list of file type which must
> begin with a version header (in the form ##vx.y## on the first line).
> The format of this configuration file is simply one file type per
> line. The type of file which needs a version header are XY, XYY.
> For each type of file configured in CONF_FILE, I need to verify to
> check if there is a version number and if there is not, I have to
> consider it as not OK (KO) .
>
> Request you to pls let me know your inputs.
>
> Thanks a lot in advance.


I sure hope this isn't homework -- it seems like it might be and I'm
helping you cheat.

for type in `cat /home/stat/temp/CONF_FILE`
do
for file in *.$type
do
if head -1 "$file" | grep -q '^##v[0-9]\.[0-9]##'
then echo "$file OK"
else echo "$file KO"
fi
done
done

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com