Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9153687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:18:50+00:00 2026-06-17T12:18:50+00:00

281~name~location~@time@room% @time2@room2 % @time3@room3; I need to delete the second line after the %

  • 0

281~name~location~@time@room%
@time2@room2%
@time3@room3;
I need to delete the second line after the % in text file. But i dont know how to do that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:18:51+00:00Added an answer on June 17, 2026 at 12:18 pm
    BufferedReader in = null;
    out = null;
    File sdCard = Environment.getExternalStorageDirectory();
    File root = new File (sdCard.getAbsolutePath() + "/yourFile");
    try {
            InputStream instream = new FileInputStream(file);
            in = new BufferedReader(new InputStreamReader(instream));
            out = new PrintWriter(new File(root,"yournewFile));
    
            String line; //a line in the file
    
        while ((line = in.readLine()) != null) {
                if (!Pattern.matches("^some pattern.*",line)) { //find the line we want to delete
                          //if it is not the line you want to delete then write it to new file
                                out.println(line);
                }
    
        }
    
        in.close();
        out.flush();
            out.close();
            File oldFile = new File (root,"/yourFile");
            oldFile.delete();
            File newFile = new File (root,"/yournewFile");
            newFile.renameTo(oldFile);
    }catch(Exception e) {
        Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT).show();
    }
    

    You should read old file and match it to the line you want to delete.if it is not the line you want to delete then write it to another file.thus you will get the new file with only that line missing which you wanted to delete.
    you are done.hope it will help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following text <select name=username><option value=177> Bob1 </option><option value=221> Bob2 </option><option value=227>
For this collapsible menu in this page: http://2ddige.com/temps/Services/proteomics%202d_dige_copy%281%29.html What changes need to be made
I have the following PHP code: class SQLStatements { public function __construct($iName) { $this->name
I'm trying to use the following code Query query; query = entityManager.createQuery(SELECT g.name FROM
I have the following text Instructor First Number Students Who Number Students Who Subject
This sample page: http://www.downloadformsindia.com/Income-Tax-Forms/challan-281.html?task=view has H1 text of Challan 281. But it's not getting
I have product_details table which belongs to categories. product_details has fields like id, name,
I've got rows in my table that contain text anywhere between 31 character and
Need a hint so I can convert a huge (300-400 mb) ASCII file to
I have this JSON from Google GeoCode and I need to decode this and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.