
30th August 2006, 13:13
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
need urgent help for writing shell script
Hello All ,
I am learning Shell Script and i am very fresher . I need help to write one shell script .
We are generating several logs files in our testsuite system . I need to generate fails as per the host ,version and productwise .
The data is stored in different directories and run.log contains fails records with ! sign . I am extracting fails from each directory but cant't accumalte as per the product wise . because product name is stored in Master file product.dat.
The product.dat is Master file contains 2 column
Test Name ProductName
/dialy/test SiCat
/daily/yyyy YRS
/daily/ttttt SiCat
/daily/rttttt SiCat
/daily/wwww PSD
/daily/uuuu YRS
The second file which is generated only contain fails test name for whole system .
The data format is like this
/users/test/krachel/9/run.log
! /daily/wwww
! /daily/test1
! /daily/rrrrr
/users/test/limo/10/run.log
! /daily/wwww
! /daily/test1
The host and version i want to extract form line /users/test/
I have store data like this
Host Version SiCat YRS PSD
limo 10 3 3 5
krache 9 5 7 0
|

30th August 2006, 13:35
|
|
Moderator
|
|
Join Date: Jul 2006
Posts: 830
Thanks: 5
Thanked 41 Times in 36 Posts
|
|
Due to the fact of not knowing shell scripting quite good, why do you want to do that with a shell script instead of using sth. like perl, python, php, scripting languages that exists on most *nix installations, that make tasks like this more easy.
|

30th August 2006, 14:11
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
please give me soultions in Perl . I will be thankful to you .
|

31st August 2006, 11:54
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hope i will get help from unix & perl experts . I am waiting fr reply .
Thanks in advance
|

31st August 2006, 14:52
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
when i will start reading and complite the program . Thanks anyway for no help .
|

1st September 2006, 00:11
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
|
|
Quote:
|
Originally Posted by dips
Hello All ,
I am learning Shell Script and i am very fresher . I need help to write one shell script .
|
This is an essential read if you want to do shell scripting: http://www.tldp.org/LDP/abs/html/index.html
|

2nd September 2006, 13:54
|
|
Moderator
|
|
Join Date: Jul 2006
Posts: 830
Thanks: 5
Thanked 41 Times in 36 Posts
|
|
Quote:
|
Originally Posted by dips
Thanks anyway for no help .
|
|

3rd September 2006, 20:40
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
The host and version i want to extract form line /users/test/
I have store data like this
Host Version SiCat YRS PSD
limo 10 3 3 5
krache 9 5 7 0
|
Um, I'm not sure exactly what you need, but if you are just wanting to extract fields from a file that is easy. For example, if the file is '/users/test/file' and the contents are what you listed above then you would grab the HOST (column 1) and VERSION (column 2) this way:
Code:
wdierkes$ cat /users/test/file | awk {' print "HOST: "$1 " VERSION: "$2 '}
HOST: limo VERSION: 10
HOST: krache VERSION: 9
That is just a very simple example. Please feel free to clarify if that doesn't answer your question.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 05:12.
|
Recent comments
20 hours 39 min ago
1 day 1 hour ago
1 day 2 hours ago
1 day 2 hours ago
1 day 3 hours ago
1 day 5 hours ago
1 day 7 hours ago
1 day 8 hours ago
1 day 8 hours ago
1 day 9 hours ago