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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:05:54+00:00 2026-05-26T20:05:54+00:00

Looking to run a script on the server to look at a path of

  • 0

Looking to run a script on the server to look at a path of a file and replace a word whereas it matches in the div.

So need to replace _toself to viewers where author equals a certain email test@example.com

URL=/var/www/sever/temp/fhyw1
FILE=user.txt

<div class='entry'>
  <div class='pageurl'>temp/fhyw1</div>
  <div class='context'>text</div>
  <div class='subject'>testing</div>
  <div class='notetext'></div>
  <div class='signed'>USER</div>
  <div class='author'>test@example.com</div>
  <div class='color'>0</div>
  <div class='visibility'>shared</div>
  <div class='to'>_toself</div>
  <div class='num'>4</div>
</div>
<div class='entry'>
  <div class='pageurl'>temp/fhyw1</div>
  <div class='context'>text</div>
  <div class='subject'>testing</div>
  <div class='notetext'></div>
  <div class='signed'>USER</div>
  <div class='author'>user@example.com</div>
  <div class='color'>0</div>
  <div class='visibility'>shared</div>
  <div class='to'>_viewers</div>
  <div class='num'>4</div>
</div>
  • 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-05-26T20:05:55+00:00Added an answer on May 26, 2026 at 8:05 pm

    This sed solution might work for you:

     sed -e '/^<div class=.entry.>/,\_^</div>_{//!{H;d};\_^</div>_!{h;d};x;/author.>test@example.com/s/_toself/SUBSTITUTE TEXT/;p;x}' text_file
    

    N.B. You will need to replace SUBSTITUE TEXT with the viewers,_viewers or whatever

    The sed command allows all lines other than those between <div class=.entry.> and </dev>(. allows for single 'or double quotes ") to pass through unchanged. If the line begins with <div class=.entry.> it is copied to a register call the hold space (HS) and then the pattern space (PS) is deleted. All other lines are appended to the HS and then deleted accepting the line </div>. When this line appears the HS is swapped with the PS and if this multiline contains author.>test@example.com then SUBSTITUTE TEXT is substituted for _toself. The multiline is printed out regardless, then the PS replaces the HS and it in turn to printed out.

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

Sidebar

Related Questions

Looking for a simple script that would run on windows 2003 server that would
I'm looking for way to PHP to detect if a script was run from
I'm looking to run a Jabber server on a Windows 2003 server(web farm) and
I'm looking to take the results of a report run (a PDF file from
I'm looking for the best way to run a nightly script that exports a
I'm looking to run some un-verified scripts (written in a yet-to-be-determined language, but needs
I'm looking to run Redmine, a Ruby on Rails app, on a VPS windows
We are looking to run a large amount of data through some unit tests.
I'm looking to run a second batch command from .bat but after the first
I am looking for the best method to run a Java Application as a

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.