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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:25:06+00:00 2026-06-08T03:25:06+00:00

I am writing an xml element in bash. I need to replace some strings

  • 0

I am writing an xml element in bash. I need to replace some strings which will start with numbers into something that starts with an character, so it is a valid XML tag (remember xml tags cannot start with alpha numeric characters).

For Example,

  str = 192.16.76.52,1001

which is not a valid xml tag, i.e i cannot do

<192.16.76.52,1001>
.....
</192.16.76.52,1001>

So, I am planning to detect if it is a number and replace it with something like

IP192.16.76.52

I know I can do it with IFS, but it might take long time and extra code.

Since you know the main problem, feel free to comment or offer suggestions.

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-06-08T03:25:08+00:00Added an answer on June 8, 2026 at 3:25 am

    The RHS of = in [[ takes a glob pattern.

    $ [[ 123 = [0-9]* ]] ; echo $?
    0
    $ [[ foo = [0-9]* ]] ; echo $?
    1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am (slowly) writing an XML parser for some site definition files that will
I am writing a component for a web app which will display some html,
I'm writing some XML in PHP that is not validating because the closing greater
I'm a student just learning xml and c#. I'm writing a program that will
I'm writing an XML schema and need to prevent the text of an element
I am writing some XML -> PDF generating templates in Apache FOP for an
I am writing a Xml Tag Renamer class with Java which reads in a
I am writing a XML file into a HTML file using JavaScript. Here is
What's the best API I can use to do some simple XML read/writing? I'm
While implementing XML file reading/writing in my application I saw that when I call

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.