Provided I have a string with multiple path files that look something like this:
"mydrive/mypath/myapp/first_app.java, mydrive/mypath/myapp/second_app.java, mydrive/mypath/myapp/third_app.java". From this string I'd like to extract only the file names without the file extension and build a new list of strings that will look like this:
"first_app, second_app, third_app" etc..
My current implementation is in Python and it looks like this:
from sys import argv
incoming_strings = argv
clean_strings_list = []
if isinstance(incoming_strings, list):
for string_to_cut in incoming_strings:
if "app" in string_to_cut:
string_to_cut_ = string_to_cut.split('/')
string_to_cut__ = string_to_cut_[len(string_to_cut_) - 1]
string_to_cut = string_to_cut__.split('.')[0]
clean_strings_list.append(string_to_cut)
print(clean_strings_list)
else:
string_to_cut_ = incoming_strings.split('/')
string_to_cut__ = string_to_cut_[len(string_to_cut_)-1]
string_to_cut = string_to_cut__.split('.')[0]
print(string_to_cut)
I am required to implement the following code with a Bash script. What would be the proper way to do that? Thanks!