I have a file "text.txt" with all lines looking like this:
directory/uninteresting1_aaa
directory/uninteresting2_bbb
directory/uninteresting3_ccc
My goal is to obtain a file with the lines looking like this:
aaa
bbb
ccc
I have printed out the lines of my text.txt file with the following code:
public void Rename(){
FileResource rs = new FileResource("text.txt");
for (String line : rs.lines()) {
System.out.println(line);
}
Can anybody give me a hint which method to use in order to loop over the lines to get them looking like I want to? Sorry in case this is really easy to solve but I am new to java and I couldn't find the answer in the forum. Thank you!