![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| shell script to remove old files and write to a log file | yabai | Shell Programming and Scripting | 3 | 05-21-2008 12:52 AM |
| Chek if a file exists in Ubuntu and Cent OS using shell script | m_kk | Shell Programming and Scripting | 2 | 03-26-2008 06:32 AM |
| Check File Exists and compare to previous day file script | rbknisely | Shell Programming and Scripting | 3 | 02-07-2008 07:53 AM |
| unix script to check whether particular file exists and to find its size | Balachandar | Shell Programming and Scripting | 9 | 02-04-2008 11:56 PM |
| how to write to file using fprintf in find command... | moxxx68 | UNIX for Dummies Questions & Answers | 2 | 10-26-2004 04:59 AM |
|
|
Submit Tools | LinkBack | Thread Tools | 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. |
| Forum Sponsor | ||
|
|