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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:53:07+00:00 2026-06-15T07:53:07+00:00

Ok I am locked in a situation where I am trying to insert a

  • 0

Ok I am locked in a situation where I am trying to insert a line based on a search string . I am familiar doing this w AWK and SED using a single work or something uncomplicated.

How I’d like to insert a string that has Single Quotes and Brackets
e.g.
this will work

     awk '/('Backup/ {print "NEWLINE"  } {print}' filename.sh 

and so will this

    sed -e '/\(\'backup/i\
    newline ' filename.sh

Instead of newline work- I want this ” (‘Drop the no good white.cap ;’ ) , “

everything enclosed within the ” and ”

  • 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-15T07:53:12+00:00Added an answer on June 15, 2026 at 7:53 am

    What you’re trying to do has nothing to do with awk or sed. For example, see:

    print " '\'' data_between_two_single_quotes '\'' "
    

    The first ' character closes the opening ' shell string literal. The shell literal does not support a backslash escape for this. The sequence '\'' does the trick: it closes the single-quote literal, specifies the quote character (using an escape that is supported outside of single-quote literals) and then re-opens a new single-quote literal. You can think of it as a four-character escape sequence to get a single quote.

    So, your awk command becomes:

    awk '/\('\''Backup/ {print " ('\''Drop the no good white.cap ;'\'' ) , " } { print }' filename.sh 
    

    And your sed command becomes:

    sed -e '/\('\''Backup/i\
    ('\''Drop the no good white.cap ;'\'' ) , ' filename.sh
    

    EDIT:

    for i in *; do awk -v database="$DB" -v table="$TB" 'BEGIN { print "header" } /backup/ { print " ('\''DROP TABLE " database "." table ";'\'' ) , " }1' "$i" > "${i}.new"; done
    

    Explanation:

    Loop over all files in the directory using a shell for loop. Add a header to the files with the BEGIN block. Find the word backup and print a line containing the shell variables DB and TB. ... }1' at the end of the awk script enables printing by default. It’s shorthand for { print }. HTH.

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

Sidebar

Related Questions

I have locked cells in a spreadsheet using this lines of code. Range(A1:D23).Select Selection.Locked
I am trying to check for locked accounts in AD. In a few snippets
I have an application that's locked down using forms authentication. There are few nightly
I'm trying to overcome the following situation. Given a directory stored on an NTFS
I am trying to use boost::shared_mutex to implement a multiple-reader / single-writer mutex. My
I'm trying to add record locking to a site. This isn't database locking where
I've been trying this for a bit now and have looked at other answers
EDIT: Problem solved. This was (yet another) situation where the problem wasn't really where
I am trying to make a label for a dynamic property using an html
I'm trying to raise an event in a mocked interface. I can get this

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.