Question: Pls using simple java language We write code that can find and replace in a given text file. The code you write should take the
Pls using simple java language We write code that can find and replace in a given text file. The code you write should take the parameters as command line arguments: java FindReplace -i -f "" -r "" -o
Only certain special characters can be found in . The question mark (?) Is related to these.
*question mark can be used instead of any character. "?al" string an be sal ,kal,val *In addition, a certain set of characters can be given in brackets. "kng[a,b,f,d,s]ne" string an be kngane,hngbne,kangfne,kangdne,kangsne So, all you have to do is match all strings that match in the input file and output (output the entire contents of the input file) output file. The input file needs to remain unchanged. * Input and output files will be a text file. Both strings will be separated by a double quotation mark (") character. To change these special characters in Java you will need to enter an escape character (backslash) like examples= java FindReplace -i input.txt -f "sam?jack[3,4,5]" -r "samjack49" -o output.txt java FindReplace -i doc -f "ali-veli k?rk dokuz elli" -r "ali veli 49 50 " -o doc2 java FindReplace -i input -o output -r "-f" -f "-r" [replace input -r with -f and write result to output file] java FindReplaca -o out -i inp -f "\[\]" -r "{}" [replace input [] with {} and write result to output file] java FindReplace -i input.txt -o output.txt -f "\[?\]" -r "[a]" [bracketed strings with single characters in it. Replace with [a]] java FindReplace -i input -o output -f "\?" -r "question mark" java FindReplace -o out -i input -f "\"" -r " ' " java FindReplace -i inp -f "sam" -r "jack"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
Students Have Also Explored These Related Databases Questions!