The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Tables and borders amatuer_lee_3 Shell Programming and Scripting 8 05-15-2008 01:57 PM
awk - list to tables Lobaria Shell Programming and Scripting 10 04-24-2008 05:07 AM
Converting tables of row data into columns of tables justthisguy Shell Programming and Scripting 7 07-16-2007 01:42 PM
finding duplicate files by size and finding pattern matching and its count jerome Sukumar Shell Programming and Scripting 2 12-01-2006 01:20 AM
use shell scripts to update tables from databases wannabegeek Shell Programming and Scripting 0 07-03-2006 02:27 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 03-01-2006
Vasundhara
Guest
 

Posts: n/a
script to search for the contents of a file

Hi all,

Please see my requirement and post me asap.

Spool all the tables names into a file . Take each table name and check if it is present in any of the scripts in a directory using grep -il command. The script has to loop through the tables list and take each table and find it's presence in directory. After this exercise, we need to get the list of tables that not present in any of the scripts.

As I am beginner to this shell scripting, I have given the below logic for this to be done. Logic can be same , but I want a clean debugged script.
I am not able to use the variables properly. Please let me know how to use the variables in this case.

Script:

for i in all_tables.txt (this is the spooled file which contains the table names)

do

tbl= head -i all_tables.txt|tail -1

search=grep -il tbl *

if(test -z $search)

then echo ${tbl}>>unused (I wanted to created a file with all the tables which are not used in the scripts)

fi

done

Thanks
Vasundhara
Forum Sponsor
  #2  
Old 03-02-2006
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,248
Looks like a homework assignment?
  #3  
Old 03-02-2006
Vasundhara
Guest
 

Posts: n/a
Hellooo sir...


As I told already I am new to this shell scripting...
I need this immediately....

Please give me some solution...


Thanks,
Vasundhara
  #4  
Old 03-02-2006
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,248
Allow me to re-phrase the question. Is this for a homework assignment?
  #5  
Old 03-02-2006
Vasundhara
Guest
 

Posts: n/a
No... this is not a home work assignment...
I am working in Unix and Oracle environment.
This script is to automate the manual work I have to do if there is no such script. I don't have time to work
  #6  
Old 03-02-2006
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,248
I see. Please post your actual script and outline the specific problems you are having with it. Include actual error messages if applicable. Someone in the forum may be able to assist.
  #7  
Old 03-02-2006
Registered User
 

Join Date: Mar 2006
Posts: 2
finding out tables not used in scripts.

I need to findout the list of tables that are not being used in scripts.

Towards that, I need to do the following activities:

1) I have all the table names in a file called tables.txt

2) Take each table name from tables.txt and Check if it is present in any of the scripts in kshscripts directory (which has all ksh scripts and which uses the tables) using grep command.

3) The script has to loop through the contents of tables.txt one by one and take each table name and find it's presence in /kshscripts directory

4) We need to get the list of tables that is not present in any of the scripts.

I don't have much experiance in shell script, Please let me know how i can accomodate the above requirement.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:29 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0