- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to locate this......?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2001 06:48 PM
06-20-2001 06:48 PM
I have a question that may seem easy for most of you, but I'm still new to all this, so bear with me.
I'm looking for a particular script that is already written and contains the word "tar" in it. It is somewhere on the system but I don't exactly know where it is. How do I locate it?
Sorry, if this seems a bit too simple for this forum but I'd really appreciate if someone can point me in the right direction. BTW, any good shell script programming sites?
Thanks for your patience.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2001 07:20 PM
06-20-2001 07:20 PM
Re: How to locate this......?
To find a script with the name "tar" in it on your system, try this find command (as root):
find / -name "*tar*"
As for the web sites for scripts, I haven't found any. Maybe some of the other people here know of some.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2001 07:24 PM
06-20-2001 07:24 PM
Re: How to locate this......?
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2001 07:32 PM
06-20-2001 07:32 PM
Re: How to locate this......?
Thanks for your reply and encouraging words.
Well, your find command looks for files that start with the word "tar". What I'm actually looking for is the contents of the file(s) that may contain the word "tar".
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2001 07:47 PM
06-20-2001 07:47 PM
SolutionIf your looking for the word 'tar' in a script,
you need to use the 'grep' command to do this.
You will most likely find that scripts could
be found in directories such as /usr/local/bin
and the like, so look do something like this:
# cd /usr/local/bin
# grep -i tar *
And as John has mentioned, ask away help here
is in abundance, in fact it is sometimes quicker
to post a question here and get an
answer than to call HP response centre.
Another idea I had was to look for it in your
crontab file if it is being used for your
backups.
Good luck
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2001 07:59 PM
06-20-2001 07:59 PM
Re: How to locate this......?
Sorry! I didn't read your question closely enough. Here is an example from the find man page that should do what you want to do:
Search the two directories /example and /new/example for files containing the string Where are you and print the names of the files:
find /example /new/example -exec grep -l 'Where are you' {} \;
So you just need to replace 'Where are you' with 'tar', and replace the directories with where you suspect the script might be and go for it.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2001 08:17 PM
06-20-2001 08:17 PM
Re: How to locate this......?
Now this is what I call Value-Added Services!!!:-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2001 01:19 AM
06-21-2001 01:19 AM
Re: How to locate this......?
Other tip
lookStr="tar"
for i in `find /dir1 /dir2 -name ?*? -print`
do
foundStr=`grep $lookStr $i`
if [[ $foundStr != "" ]]
then
echo "-=> String '$lookStr' found in file '$i' "
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2001 03:59 AM
06-21-2001 03:59 AM
Re: How to locate this......?
With regard to learning shell scripting, here are two threads with many suggested "favorite" sources for education. The best way, as always, is to simply write, write, write. Take a look at these:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xb75e7e990647d4118fee0090279cd0f9,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xbb5e7e990647d4118fee0090279cd0f9,00.html
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2001 05:24 AM
06-21-2001 05:24 AM
Re: How to locate this......?
Mark
ps. don't forget to make the script executable after you write it!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2001 02:39 PM
06-21-2001 02:39 PM
Re: How to locate this......?
#!/bin/sh
PATH=/usr/bin:/usr/sbin
export PATH
LOG='/tmp/files_that_contain_tar'
TMPLIST='/tmp/tmp_list.txt'
if [ -f ${LOG ] ; then
rm -f ${LOG}
fi
if [ -f ${TMPLIST} ] ; then
rm -f ${TMPLIST}
fi
touch ${LOG}
touch ${TMPLIST}
find / -type f -print >> ${TMPLIST}
for FILE in `cat ${TMPLIST}` ; do
TESTASCII=`file ${FILE}|grep -i text`
if [ "${TESTASCII}x" = "x" ] ; then
#DISCARD
echo "">>/dev/null
else
TEST4TAR=`grep tar ${FILE}`
if "${TEST4TAR}x" = "x" ] ; then
# it aint there...
echo "">>/dev/null
else
# It's there...put it into a log...
echo ${FILE} >>${LOG}
fi
fi
# END OF SCRIPT
I did not debug this, but it should be okay...
The beauty of UNIX is that there are millions of ways to attack and solve problems. There's lots of built in logic, if you know where it is, and how to use it....
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2001 09:36 PM
06-21-2001 09:36 PM
Re: How to locate this......?
I'm truly encouraged with all the responses and help I got fr everyone! Thanks for the support! I'm really glad I found this forum. It's made my load much lighter.
THANKS FOR ALL THE SUPPORT!