- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need script help
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
03-07-2003 09:42 AM
03-07-2003 09:42 AM
Step 1)
find /fntst2 -type l -exec ll -d {} \; >/tmplnk
(this locates my link and puts them out to a temporary file)
Step 2) I want to search this file and print out all of the lines that DO NOT match my search criteria...the bad links. How do I search this temporary file for multiple strings? i.e. - vgx001, vgx002, vgx003 and then print out the lines that do not match.
I know I could do a grep -v vgx001 file but that would pull up my valid links as well. Any help is greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 09:53 AM
03-07-2003 09:53 AM
Re: Need script help
find /fntst2 -type l -exec ll -d {} \; | grep -e name1 -e name2 -e name3
Or you could use file instead of ll to identify links that point nowhere...
find /fntst -type l -exec file {} \; | grep "cannot open"
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 09:55 AM
03-07-2003 09:55 AM
Re: Need script help
grep -vE 'vgx001|vgx002|vgx003' file
should print out the non-matching lines for you.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 10:01 AM
03-07-2003 10:01 AM
Re: Need script help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 10:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 10:13 AM
03-07-2003 10:13 AM
Re: Need script help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 10:17 AM
03-07-2003 10:17 AM
Re: Need script help
But it's -v you want - that will print the non match. From man grep:
" -v All lines but those matching are printed."
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 10:47 AM
03-07-2003 10:47 AM
Re: Need script help
Im using John's suggestion to locate bad links and Pete's suggestion to locate improperly allocated links.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 05:56 PM
03-07-2003 05:56 PM
Re: Need script help
do
rm $a
done
(* Can't test right now. :-( *)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 06:00 PM
03-07-2003 06:00 PM
Re: Need script help
find /fmtst2 -type -l -print | perl -nle '-e || print' | while read a
do
rm $a
done
Note: This will just find them. (* TESTED *)
find /fmtst2 -type -l -print | perl -nle '-e || print' > /tmp/file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2003 03:38 PM
03-09-2003 03:38 PM
Re: Need script help
#!/usr/bin/sh
# search and destroy broken
# symlinks in current dir.
find . -type l -xdev | while read link junk
do
[ -e "$link" ] || rm $link
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2003 12:23 PM
03-10-2003 12:23 PM
Re: Need script help
#!/usr/bin/sh
# search and destroy broken
# symlinks in current dir.
find . -type l -xdev | while read link
do
[ -e "$link" ] || echo \"$link\"
done | xargs rm
The quotes should account for any whitespaces in the file names.