- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script needed.
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
09-08-2006 04:40 AM
09-08-2006 04:40 AM
I would like to write perl/shell script for the below requirement.
1) Read line by line words from a file.
2) Search that word in multiple directories
3) If it finds that word in any file, log that filename with the full path into an output file.
Thanks
DK
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2006 05:22 AM
09-08-2006 05:22 AM
Re: Script needed.
for word in `cat file`
do
grep $word /list/* /of/dirs/* | awk -F: '{print $1}' > logfile
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2006 05:23 AM
09-08-2006 05:23 AM
Re: Script needed.
for word in `cat file`
do
grep $word /list/* /of/dirs/* | awk -F: '{print $1}' >> logfile
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2006 05:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2006 06:54 AM
09-08-2006 06:54 AM
Re: Script needed.
For a different approach...
#!/usr/bin/sh
F_IN=/your/file
F_OUT=/your/results
tr -s "[:space:]" "[\n*]" < ${F_IN} > /tmp/wl.${$}
find / -print | grep -F -f /tmp/wl.${$} > ${F_OUT}
rm -f /tmp/wl.${$}
exit
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2006 08:43 PM
09-10-2006 08:43 PM
Re: Script needed.
a one-line command:
grep -l -f file /dir1/dir1/* /dir2/dir/*
This command print only the fullpatchname of teh file where the search string conatined into file are found.
this run on my HP-UX11i.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2006 01:56 AM
09-11-2006 01:56 AM
Re: Script needed.
Thanks to everyone...
Cheers
DK