Home » Infrastructure » Unix » Shell script
Shell script [message #614330] Tue, 20 May 2014 22:13 Go to next message
appsoracle2
Messages: 5
Registered: May 2014
Location: India
Junior Member
[size=4] I want to write a script to identify oracle tables in RDFs (oracle reports).

I have written as below

>vi grep_identify_tab.sh (Shell script name)

#!/bin/bash

INPUT_FILE=$1 (we will pass the rdf file name)
TABLE=$2 (will pass the table name which we need to search)
grep "$TABLE" $INPUT_FILE


But I don't think that it will work because shell will not be able to open and read the .rdf format.

So any expert advice on this will be appreciated.

Thanks

Datta
Re: Shell script [message #614333 is a reply to message #614330] Tue, 20 May 2014 22:41 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
strings $INPUT_FILE | grep -i $TABLE
Re: Shell script [message #614337 is a reply to message #614333] Wed, 21 May 2014 00:09 Go to previous messageGo to next message
appsoracle2
Messages: 5
Registered: May 2014
Location: India
Junior Member
Thanks for the reply.

But here my i/p file is in .rdf format. So will it be readable in unix?
Re: Shell script [message #614340 is a reply to message #614337] Wed, 21 May 2014 00:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Why don't you just execute BlackSwan's command line to verify?

You can also execute "man strings" to know what is this tool (this answer your question).

Re: Shell script [message #614361 is a reply to message #614340] Wed, 21 May 2014 03:16 Go to previous messageGo to next message
appsoracle2
Messages: 5
Registered: May 2014
Location: India
Junior Member
Hi

Thanks Smile
Re: Shell script [message #614364 is a reply to message #614333] Wed, 21 May 2014 03:19 Go to previous messageGo to next message
appsoracle2
Messages: 5
Registered: May 2014
Location: India
Junior Member
Hi,

Thanks Smile
Re: Shell script [message #614689 is a reply to message #614333] Mon, 26 May 2014 00:52 Go to previous messageGo to next message
appsoracle2
Messages: 5
Registered: May 2014
Location: India
Junior Member
Hi,

While I am running the commands,its throwing the below error. Can you please help me

$ grep -i $TABLE $INPUT_FILE >INFO.txt

sh: TABLE: Parameter not set.

I have tried to set the table parameter as well.

Thanks

Arijit
Re: Shell script [message #614694 is a reply to message #614689] Mon, 26 May 2014 02:12 Go to previous message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I think the OS is correct and you wrong.
Did you export TABLE?
Anyway, this is not an Oracle question and so it is out of the scope of this forum.
I advise you to take a basic course about Unix shell and tools.

Previous Topic: how to check overall utilization in unix?
Next Topic: Use of mknod command .
Goto Forum:
  


Current Time: Thu Mar 28 09:28:41 CDT 2024