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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:30:17+00:00 2026-06-08T16:30:17+00:00

I have a command that outputs some text that I would like to input

  • 0

I have a command that outputs some text that I would like to input to the sed’s “replaced text” field. But I’m getting the

sed: -e expression #1, char 24: unterminated `s' command error.

Here is the important snippet:

input=$(./mid 1 10 random.txt)       
echo $input       
cat $1 |sed "s/times/$input/g" > tester5.txt

And here is the command line output:

$ ./Batchtest tester.txt      
some random text some random text some random text some random text      
sed: -e expression #1, char 24: unterminated `s' command

As you can see the “./mid 1 10 random.txt” outputs some text that I want to plugin to sed’s “replaced text” field, but it’s not working. I’ve tried adding quotes around $input, but that doesn’t help.

Any help would be much appreciated!

  • 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-08T16:30:20+00:00Added an answer on June 8, 2026 at 4:30 pm

    With awk, you can put the output in a variable using the -v option. Using this method, you don’t have to worry about characters special to sed’s syntax in the output.

    input=$(./mid 1 10 random.txt)
    awk -v input="$input" '{ gsub(/times/,input); print }' "$1" > tester5.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little c# console program that outputs some text using Console.WriteLine. I
I have a command line that I'm trying to modify to remove some of
I have a Grails command object that contains an emailAddresses field, e.g. public class
I currently have some code that cycles through a text file looking for a
I have a file name foo. That file contains some text (shown below). Can
I would like to echo text and also remotely ping a computer and have
I have a command that I want to run on machine B from machine
I have a command (cmd1) that greps through a log file to filter out
I have a command line program that prints out a report such as: I
I have a bulk insert command that I am issuing through C#. Is the

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.