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

The Archive Base Latest Questions

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

In my company style guide it says that bash scripts cannot be longer than

  • 0

In my company style guide it says that bash scripts cannot be longer than 80 lines. So I have this gigantic sed substitution over twice as long. How can I break it into more lines so that it still works? I have

sed -i s/AAAAA...AAA/BBBBB...BBB/g

And I want something like

sed -i s/AAAAA...AAA/
BBBBB...BBB/g

still having the same effect.

  • 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-09T03:30:49+00:00Added an answer on June 9, 2026 at 3:30 am

    Possible ways to clean up

    1) Put your sed script into a file

    sed -f script [file ...]
    

    2) Use Regex shorthand

    sed 's!A\{30,\}!BBBBB...BBBB!g'
    

    3) Use Bash variables to help break it up a bit

    regex="AAAA.AAAAAA"
    replace="BBBB...BBBBBBB"
    sed "s/${regex}/${replace}/g"
    

    What not to do

    1) Escape the newline to break it up into multiple lines.

    You will end up with a newline in your sed script that you don’t want.

    sed 's/THIS IS WRONG /\
    AND WILL BREAK YOUR SCRIPT/g'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a naming style in a company I work for that this must
I have a set of Wiki pages (MediaWiki style) on my company's intranet that
In my current company, we have this decade old...let's call it a Hello World
I work for a large company that has adopted sharepoint. I have been tasked
I have a web page that lists open jobs at a company, in the
I have try to standardize signature in my company. <html xmlns=http://www.w3.org/1999/xhtml > <head> <style
I'm working for a company that has strict coding style guidelines but no automatic
I have a WPF Window defined in XAML like this: <Window x:Class=com.some.company.window xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
Our company produces cross-platform software and we have Bamboo instance which is building projects
The company i am working for is implementing Share-point with reporting servers that runs

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.