How to extract a text from a file


Discussion:

Q: A text file containing sentences and random sequences of letters, symbols and numbers. I have to write a program that will extract only the text sent to a particular device and ignore the rest of the messages. Each message sent has an identifying two characters header (first being a $ followed by a single character) followed by a two digit number indicating the size of the message followed by the message itself. I have to extract out only the set of messages (lines of text) addressed to me. Ex) My identifying two characters is $Y so the program will only extract messages sent to $Y devices.

Example input:
oprfjiad093$X5abcdep0qj3 fqijfpiqjef$Y21Your message to find.p9iqjv0$Ea0n wq9r r$Y13Next Message.09q 4r9 qefkjad0fu8;lkfdv98

Example output:
Your message to find.
Next Message.

Enter message file: Enter real message file:

$Zqva'HMQ[V$L01$Y56On the twelfth day of Christmas my true love gave to mexN\t}h0{YS/L$X66The 1997 Chautauqua Program has been released. This is a faculty !-2_w2@~:M/u#$/$X71development program of the National Science Foundation. While much of ]gP0@uItU}1WkCS$L71the information is directed to science and mathematics, some of it is $Y69twelve drummers drumming, eleven pipers piping, ten lords a-leaping,E9`$S60more general in nature and appropriate to all disciplines. $A01$Y68nine ladies dancing, eight maids a-milking, seven swans a-swimming,DFIaZ\^zQ'NV$X73The short courses are usually three days long and are limited to around HtwGa&l+Lcgb$S6725 participants. The application requires a statement of interest $Y37six geese a-laying, five gold rings;E~(s8Qr5YALv$X73explaining why you want to take the course and how you will use it when $Y56four calling birds, three french hens, two turtle dovesj$_eE]p$j4l$S68you return to your home institution. They are presented at various @R~Z,v>$M71locations around the country, including Atlanta, Memphis, and Dayton, $Y32and a partridge in a pear tree.6*`lWT$M06Ohio.s'$L01p}/d

Attachment:- Extracting the Good Stuff.rar

Solution Preview :

Prepared by a verified Expert
Computer Network Security: How to extract a text from a file
Reference No:- TGS01932741

Now Priced at $25 (50% Discount)

Recommended (99%)

Rated (4.3/5)