mAdMaLuDaWg
Platinum Member
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.
I really have little experience with shell scripting so if someone can give me a few pointers, it would be much appreciated.
So I have the following command, to get the applications to gets each application directory that contains the message.jar file.
find . -name "message.jar" 2> /dev/null | cut -d "/" -f 2
Now, I just need to figure out how to write a command/script that uses that output to search for a licenseKey= in each application subdirectory and if it is not present, spit the application name out...
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.
I really have little experience with shell scripting so if someone can give me a few pointers, it would be much appreciated.
So I have the following command, to get the applications to gets each application directory that contains the message.jar file.
find . -name "message.jar" 2> /dev/null | cut -d "/" -f 2
Now, I just need to figure out how to write a command/script that uses that output to search for a licenseKey= in each application subdirectory and if it is not present, spit the application name out...