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

The Archive Base Latest Questions

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

I am using following kind of script in my perl script and expecting entry

  • 0

I am using following kind of script in my perl script and expecting entry at line 1. I am getting some error as below; any help?

plz ignore perl variable….

Error Messaage –
sed: -e expression #1, char 22: extra characters after command

# Empty file will not work for Sed line number 1
    `"Security Concerns Report" > $outputFile`;

    `sed '1i\
    \
    DATE :- $CDate \
    Utility accounts with super access:- $LNumOfSupUserUtil \
    Users not found in LDAP with super access: - $LNumOfSupUserNonLdap\

    ' $outputFile > $$`;
    `mv $$ $outputFile`;
}
  • 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-09T12:09:08+00:00Added an answer on June 9, 2026 at 12:09 pm

    Your immediate problem is that the backslash character is interpreted by Perl inside the backtick operator, as is the dollar character. So your backslash-newline sequence turns into a newline in the shell command that is executed. If you replace these backslashes by \\, you’ll go over this hurdle, but you’ll still have a very brittle program.

    Perl is calling a shell which calls sed. This requires an extra level of quoting for the shell which you are not performing. If your file names and data contain no special characters, you may be able to get away with this, until someone uses a date format containing a ' (among many things that would break your code).

    Rather than fix this, it is a lot simpler to do everything in Perl. Everything sed and shells can do, Perl can do almost as easily or easier. It’s not very clear from your question what you’re trying to do. I’ll focus on the sed call, but this may not be the best way to write your program.

    If you really need to prepend some text to an existing file, there’s a widely-used module on CPAN that already does this well. Use existing libraries in preference to reinventing the wheel. File::Slurp has a prepend_file method just for that. In the code below I use a here-document operator for the multiline string.

    use File::Slurp; # at the top of the script with the other use directives
    File::Slurp->prepend_file($outputFile, <<EOF);
    DATE :- $CDate
    Utility accounts with super access:- $LNumOfSupUserUtil
    Users not found in LDAP with super access: - $LNumOfSupUserNonLdap
    EOF
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bash-script (let's call it /usr/bin/bosh ) using the following she-bang line:
I am using following command for start the production server. nohup ruby script/server webrick
I once saw the GLMM modeling building process using the following script: dative.glmm8 <-
Hmm. Instead of defanging input or using some kind of regex to remove tags,
I am currently using Instruments via a bash script to initiate the command-line interface
I have a kind of strange issue. In my bash script or Makefile, using
I'm using bash shell. Hi,ppl Would be glad if someone could provide some kind
I am using the following regexp to match all occurrences of a special kind
Possible Duplicate: Show modal JS dialog on any site using button I need some
Using following code I try to get updated list of checkbuttons' corresponding text values,

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.