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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:58:33+00:00 2026-06-09T13:58:33+00:00

Is there a way in grep/egrep to extract tricky patterns from this text, insert

  • 0

Is there a way in grep/egrep to extract tricky patterns from this text, insert them at the start of a line with its line remainder, so that it looks like the following?

Raw text that has been extracted from many files which have the word “nonspecific”. Now I need to organize these so that the names start at the start of the line so that they are easier to read. It would help to insert a blank line in between them as well but that may be not possible in egrep?

Input:

SofasCouchesChairs/Type1234567.xml:Nonspecific Couch-W ISSUESTablesDesks/Type123765.xml:Nonspecific Tables issues BedsDivans/Type4567345.xml:Nonspecific bed abnormalitiesBedBugs/Type2893993.xml:Nonspecific bugs in the spring boxes related to the mattressBed_Sofas/Type1317994.xml:Nonspecific WR abnormalities these are from Radios_TV/Type1274978.xml:radiation perhaps with nonspecific cell phones and cell towers Cabinets_TelephoneWires/Type1299691.xml:DATA:all kinds of nonspecific cell phone wave changes, with a 

Expected output:

SofasCouchesChairs/Type1234567.xml:Nonspecific Couch-W ISSUES

TablesDesks/Type123765.xml:Nonspecific Tables issues 

BedsDivans/Type4567345.xml:Nonspecific bed abnormalities

BedBugs/Type2893993.xml:Nonspecific bugs in the spring boxes related to the mattress

Bed_Sofas/Type1317994.xml:Nonspecific WR abnormalities these are from 

Radios_TV/Type1274978.xml:radiation perhaps with nonspecific cell phones and cell towers

Cabinets_TelephoneWires/Type1299691.xml:DATA:all kinds of nonspecific cell phone wave changes, with a 
  • 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-09T13:58:34+00:00Added an answer on June 9, 2026 at 1:58 pm

    See comments; the input is actually:

    SofasCouchesChairs/Type1234567.xml:Nonspecific Couch-W ISSUES
    TablesDesks/Type123765.xml:Nonspecific Tables issues 
    BedsDivans/Type4567345.xml:Nonspecific bed abnormalities
    BedBugs/Type2893993.xml:Nonspecific bugs in the spring boxes related to the mattress
    Bed_Sofas/Type1317994.xml:Nonspecific WR abnormalities these are from 
    Radios_TV/Type1274978.xml:radiation perhaps with nonspecific cell phones and cell towers
    Cabinets_TelephoneWires/Type1299691.xml:DATA:all kinds of nonspecific cell phone wave changes, with a
    

    You can double space your output to match the expected output:

    sed G input.txt > output.txt
    

    An aside, if your are trying to make things easier to read, you can experiment with the number of G’s. For example, this will triple space your file:

    sed G;G input.txt > output.txt
    

    Also, to make the changes directly to your file, you can using the -i flag (this saves us from having to unnecessarily create output.txt):

    sed -i G input.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an easy way using grep (or combine with other standard command line
is there a way to grep(find) the text in a particular file, which is
Is there any way of prepending a line of text to a set of
Is there a way to use grep or awk to find text files that
Using only grep and sed, is there a way I can tranform the output
Is there way to get file from windows xp command prompt? I tried to
is there way how to get name ov event from Lambda expression like with
Is there way to set @include mixin(); to variable? I tried this @mixin bg-gradient($fallback,
Is there way that I can read the file from remote server using fopen
Is there any way to fit in 1 line using the pipes the following:

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.