I have a file like this:1;1471375551;joe;WO12344;2;1471378551;frank;WO12345;14713802113;1471383211;frank;WO12345;14713852114;1471385311;frank;WO12345;5;1471385311;joe;WO12346;1471388211I'd like to use a bash script to find the line that contains a specified name (like frank) as well as a specified WO number (like WO12345) and also ends with a ;, then add a string to the end of the line.  I want to edit the file directly, not output to stdout.  I know how to use read to get the name and WO number. I'm guessing sed with -i is the right tool.  How can I do that?
How can I add text to the end of a line that contains multiple strings?
text processing;sed;awk
If the name and WO are always consecutive, it's quite straightforward:sed  '/frank;WO12345;/s/;$/;sometext/' -i fileIf they can appear either way around, or not necessarily next to each other, use blocks of commands to combine the two tests:sed  '/;frank;/{/;WO12345;/s/;$/;sometext/}' -i file