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 8065925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:49:11+00:00 2026-06-05T11:49:11+00:00

I have some reports in html file. I need to place them to excel

  • 0

I have some reports in html file. I need to place them to excel and make some changes, so I thought I could do those changes beforehand using powershell. Some of the lines are in fixed places, others are not so I need to delete them by making the script recognize a pattern.

Fixed lines starting from top: 12-14,17,19,25-27,30-32,40-42
Fixed lines starting from bottom: 3-13, 48-60

The pattern I need to find and delete, is this:

<td align="center">random string</td>
<td align="left">random string</td>
<td align="left">random string</td>
<td align="left">random string</td>
<td align="right">random string</td>

For the fixed lines I found I can do this:

(gc $maindir\Report23.HTML) | ? {(12..14) -notcontains $_.ReadCount} | out-file $maindir\Report23b.HTML

It works as it deletes the lines 12-14 but I need to put the rest of the fixed line numbers in the same command and I can’t seem to figure out how. Also the output file’s filesize is twice the original’s, which I find weird. I tried using set-content which produces a filesize close to the original but breaks the text encoding in certain parts.

I have no idea how to go about for recognizing the pattern though…

  • 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-05T11:49:12+00:00Added an answer on June 5, 2026 at 11:49 am

    The output file’s filesize is twice the original because the original file was probably ASCII-encoded, the new file is per default Unicode-encoded. Try this:

    $length = (gc $maindir\Report23.HTML).length
    $rangefrombottom = ($length-60)..($length-48)+($length-13)..($length-3)
    $rangefromtop = 12..14+17,19+25..27+30..32+40..42
    (gc $maindir\Report23.HTML) | ? {$rangefromtop -notcontains $_.ReadCount} | ? {$rangefrombottom -notcontains $_.ReadCount} | out-file -encoding ASCII $maindir\Report23b.HTML
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some reports in HTML format and want print them in my web
I need some clarification. I have a Reportwriter dll that uses Crystal Reports. It
I have some files that are uuencoded, and I need to decode them, using
I have a html file (contains some text and one image) stored @ /sdcard/test
I have some reports written in JasperReports and they display html entities literally, for
I have a web application that produce some reports in HTML format. I have
I have some Crystal Reports connecting to a Sql Server db that I would
I have some code which handles data files and reports an error when it
I have ASP.NET page with an iframe on it for displaying some pdf reports
I have a script that generates a temporary HTML file that has links to

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.