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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:33:27+00:00 2026-05-27T07:33:27+00:00

I have a file which is created by a program. It contains html code

  • 0

I have a file which is created by a program. It contains html code and propitiatory calls to other software. In this file there are many variations of:

<td>$GETR("wp","1")$Yes$GETR("","2")$No$NOTE()$</td>

so it could be:

<td>$GETR("dc","1")$Yes$GETR("","2")$NO$GETR("","3")$NA$NOTE()$</td>

or:

<td>$GETR("tc","1")$Yes$NOTE()$</td>

etc

I have created a script which properly formats these files but this bit I am stuck with.
I want the script to search through the file and if it finds more that one GETR between and then to put each GETR on a new line tabbed, so like:

<td>
    $GETR("wp","1")$Yes
    $GETR("","2")$No$NOTE()$ 
</td>

Now if there is only one occurrence of GETR between:

<td> and </td>

I would like it to be changed to GETC, so:

<td>$GETR("tc","1")$Yes$NOTE()$</td>

would become:

<td>
    $GETC("tc","1")$Yes$NOTE()$
</td>

Any ideas how I can do this? I currently have a bash script which does some moving around which calls a python script to replace some formatting.

I am using Sun Solaris 5.10

Thanks

  • 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-27T07:33:28+00:00Added an answer on May 27, 2026 at 7:33 am

    This is what you are desiring?

    >>> x='<td>$GETR("wp","1")$Yes$GETR("","2")$No$NOTE()$</td>'
    >>> if x.count("$GETR")>1:
        x=x.replace("$GETR","\n\t$GETR").replace("</td>","\n</td>")
    
    
    >>> print x
    <td>
        $GETR("wp","1")$Yes
        $GETR("","2")$No$NOTE()$
    </td>
    >>> x='<td>$GETR("","2")$No$NOTE()$</td>'
    >>> if x.count("$GETR")>1:
        x=x.replace("$GETR","\n\t$GETR").replace("</td>","\n</td>")
    
    
    >>> print x
    <td>$GETR("","2")$No$NOTE()$</td>
    

    In that case try this

    if x.count("$GETR")>=1:x=x.replace("$GETR","\n\t$GETR").replace("</td>","\n</td>")
    if x.count("$GETR") == 1: x=x.replace("$GETR","$GETC")
    
    
    >>> x='<td>$GETR("","2")$No$NOTE()$</td>'
    >>> if x.count("$GETR")>=1:x=x.replace("$GETR","\n\t$GETR").replace("</td>","\n</td>")
    >>> if x.count("$GETR") == 1: x=x.replace("$GETR","$GETC")
    >>> print x
    <td>
        $GETC("","2")$No$NOTE()$
    </td>
    >>> x='<td>$GETR("wp","1")$Yes$GETR("","2")$No$NOTE()$</td>'
    >>> if x.count("$GETR")>=1:x=x.replace("$GETR","\n\t$GETR").replace("</td>","\n</td>")
    >>> if x.count("$GETR") == 1: x=x.replace("$GETR","$GETC")
    >>> print x
    <td>
        $GETR("wp","1")$Yes
        $GETR("","2")$No$NOTE()$
    </td>
    >>> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a concurrent, recursive directory traversal and file processing program, which sometimes
I have a berkeley db file (*.bdb) which is created by the C implementation(python
I have created a file argument.pl which takes several arguments first of which should
I have created a library which reads the app.config file and gets the type
Problem I have a file which contains such text (nothing else) 2010-10-05 I would
I have created a small program to write XML-Comment for Properties(which dont have customer
I have a text file called playlist.pls which is dynamically created, and in the
I have an old setup of the old program written on c++ which contains
I have created a little program that reads in a Java file and feeds
I have a CSV file which contains a mixture of English and Chinese characters

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.