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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:50:33+00:00 2026-05-30T12:50:33+00:00

The best problem description is given by looking at http://rubular.com/r/9zDHFh0gGc . Why is sed

  • 0

The best problem description is given by looking at http://rubular.com/r/9zDHFh0gGc. Why is sed not working like that? I think the problem depends on those backslashes \in the fragments, for example in {1+\cos^2 t + t^2}.
In precise I want to substitute in the source

Test Text
= \int_0^{\pi}\vvvec
{1+\cos^2 t + t^2}
{1+ \sin^2 t + t^2}
{1 + 2 t^2}
\cdot \vvvec{-2\cos t \sin t}{2\cos t \sin t}{2t}\ud t =
Ende

by the command sed -r 's/\\vvvec[[:space:]]*\{([^\}]*)\}[[:space:]]*\{([^\}]*)\}[[:space:]]*\{([^\}]*)\}/\\begin\{pmatrix\}\1\\\\\2\\\\\3\\end\{pmatrix\}/g' source and hope to get the result

Test Text
= \int_0^{\pi}\begin{pmatrix}1+\cos^2 t + t^2\\1+ \sin^2 t + t^2\\1 + 2 t^2\end{pmatrix}
\cdot \begin{pmatrix}-2\cos t \sin t\\2\cos t \sin t\\2t\end{pmatrix}\ud t =
Ende

I’m sorry – I can not see, why is is not working.
The string seems to be okay, as echo "\vvvec{1}{2}{3}" | sed -r 's/\\vvvec[[:space:]]*\{([^\}]*)\}[[:space:]]*\{([^\}]*)\}[[:space:]]*\{([^\}]*)\}/\\begin\{pmatrix\}\1\\\\\2\\\\\3\\end\{pmatrix\}/g'
\begin{pmatrix}1\\2\\3\end{pmatrix}
is working fine.
It stops working when inserting \sin for example in one component.

  • 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-30T12:50:34+00:00Added an answer on May 30, 2026 at 12:50 pm

    The backslash is not needed within a character class, in fact it adds the backslash to the class. Because of this \{([^\}]*)\} won’t match {\cos t}.

    So, this seems to work:

    sed -r 's/\\vvvec[[:space:]]*\{([^}]*)\}[[:space:]]*\{([^}]*)\}[[:space:]]*\{([^}]*)\}/\\begin\{pmatrix\}\1\\\\\2\\\\\3\\end\{pmatrix\}/g'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that I feel is best implimented in a stand alone
I've got a problem I'm not sure how best to solve. I have an
Below is the problem description and algorithm that I have written. Is there anything
I am looking for an algorithm that will solve my problem in the most
Problem Description: Multi-player Game that works over the some kind of network, in game
Problem Description I am writing a Java application that lets programmers query for page
Given an enum that has assigned values, what is the best way to get
Interested in description of your most used ASP.NET httpmodules that solved a specific problem
Post your best solutions! You can find the full problem description and examples here:
I'll try to explain my problem the best I can, here goes: I have

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.