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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:38:19+00:00 2026-06-12T14:38:19+00:00

Suppose I have a configuration file that can be in one of two format

  • 0

Suppose I have a configuration file that can be in one of two format below (short example, but basically the first format is a line that is too long that you have to use a line continuation character, while the second format is just simply a long line without the line continuation)

data1=x data2=y data3=z \
datakey

second format

data=1 data2=y data3=z datakey

I want to match the exact line data1=x data2=y data3=x datakey for both situation. Is there simple way of doing that?

  • 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-12T14:38:20+00:00Added an answer on June 12, 2026 at 2:38 pm

    I would use sed to create an output without the ending \:

    sed -e ':begin;/\\$/{N;bbegin};s/\\\n//g' your_file
    

    Then you could grep it:

    sed -e ':begin;/\\$/{N;bbegin};s/\\\n//g' your_file | grep your_pattern
    

    You can even do this all in sed:

    sed -n -e ':begin;/\\$/{N;bbegin};s/\\\n//g;/your_pattern/p' your_file
    

    UPDATE:

    To explain above:

    • :begin sets a tag to which I can branch (goto) with the b command.
    • /\\$/{N;bbegin} if the current line ends with a \ (/\\$/), append the next line to the buffer (N) and goto begin (bbegin).
    • Then, when the lines does not end with a \, remove all the \ and the line break (thes/\\n//g`).
    • Then -n option tells sed no to print the line at the end of the script.
    • /your_pattern/p prints the line if it matches your_pattern.

    UPDATE2:

    We could even do better and show the original lines of your file:

    sed -n -e ':begin;/\\$/{N;bbegin};h;s/\\\n//g;/your_pattern/{g;p}' your_file
    

    What this does is before removing the \ and the line break, it saves the data in the hold space (h) and if the line matches, it prints the data that was saved (g copies the hold space to the pattern space that is printed).

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

Sidebar

Related Questions

I have the following configuration file that is very similar to the standard example
I have a configuration file that is supposed to have \r\n line ending style,
I have situation, where I want to read configuration file only one time, when
I have a configuration file in xml, with increasing specificity. That is, the closest
Suppose I have a large list of words. For an example: >>> with open('/usr/share/dict/words')
Suppose I have a pure virtual method in the base interface that returns to
Suppose I have a static method of my class that returns an object of
Suppose I have a class Baz that inherits from classes Foo and Bar ,
Suppose I have a process that is updating a record and encounters a record
Suppose I have two tables, - emp(empId number(1),empName varchar2(50)) and - manager(manId number(5),managerName varchar2(100))

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.