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

  • Home
  • SEARCH
  • 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 8758001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:26:18+00:00 2026-06-13T14:26:18+00:00

Searched for similar problems and could not find anything that suits my needs exactly:

  • 0

Searched for similar problems and could not find anything that suits my needs exactly:

I have a very large HTML file scraped from multiple websites and I would like to replace all

class="key->from 2nd file"

with

style="xxxx"

At the moment I use sed – it works well but only with small files

while read key; do sed -i “s/class=\”$key\”/style=\”xxxx\”/g”
file_to_process; done < keys

When I’m trying to process something larger it takes ages

Example:

keys - Count: 1233 lines
file_to_ process - Count: 1946 lines

It takes about 40 s to complete only 1/10 of processing I need

real    0m40.901s
user    0m8.181s
sys     0m15.253s
  • 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-13T14:26:19+00:00Added an answer on June 13, 2026 at 2:26 pm

    Untested since you didn’t provide any sample input and expected output:

    awk '
    NR==FNR { keys = keys sep $0; sep = "|"; next }
    { gsub("class=\"(" keys ")\"","style=\"xxxx\"") }
    1' keys file_to_process > tmp$$ &&
    mv tmp$$ file_to_process
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched for hours but could not find anything similar. The crash has
I quickly searched for this before posting, but could not find any similar posts.
(I've searched for something similar, but haven't found anything that matches and/or works) I
I searched many of the similar questions, but could not solve my problem. I
Introduction I have a problem that I'm finding very mysterious. I've searched on Google
I've searched around for people having similar problems, but to no avail. I'm trying
I am not sure if a similar question has been asked before, searched for
We have a BusinessObjects Enterprise XI server which I believe is similar (if not
I've searched thoroughly for a similar topic and couldn't find one. Here's hoping someone
I'd like to point out right away that I have already searched the site

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.