![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| shell script to remove old files and write to a log file | yabai | Shell Programming and Scripting | 4 | 12-09-2008 01:08 PM |
| Chek if a file exists in Ubuntu and Cent OS using shell script | m_kk | Shell Programming and Scripting | 2 | 03-26-2008 10:32 AM |
| Check File Exists and compare to previous day file script | rbknisely | Shell Programming and Scripting | 3 | 02-07-2008 11:53 AM |
| unix script to check whether particular file exists and to find its size | Balachandar | Shell Programming and Scripting | 9 | 02-05-2008 03:56 AM |
| how to write to file using fprintf in find command... | moxxx68 | UNIX for Dummies Questions & Answers | 2 | 10-26-2004 07:59 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Need to write a script in UNIX to find a file if another file exists
So I have a lot of Java applications on my servers all having their own folder from the applications subdirectory. Now, I need to do the following.
Search all the applications subdirectories for message.jar. If the message.jar file exists, I need to search the application directory for license text. For example, my application subdirectory consists of the following application folders. application/messagingApp/ application/databaseApp/ application/toolsApp/ Now when I run the following command from :/application: :/application % find . message.jar -print I get the following: application/messagingApp/common/jars/message.jar application/toolsApp/jars/message.jar Now, since I know that the messagingApp and toolsApp contains message.jar, I now need to search all files in the directory (subdirectories don't have to be searched) application/messagingApp and application/toolsApp for the following text: licenseKey=, and if it doesn't exist, I need to know what the application folder is. For example, application/messagingApp/licensing.prop contains licenseKey= but there is no file in application/toolsApp that contains licenseKey= and toolsApp should be the output of the program. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|