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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:35:00+00:00 2026-06-16T23:35:00+00:00

I am trying to parse some text files with the command line. part of

  • 0

I am trying to parse some text files with the command line. part of this involves reattaching broken words in some badly-formatted emails. An example:

9,650 330,765.0  16.38% NYSE (000) 1,707,915 272,099.0  18.95%     Commodit=
ies Close Change % Change Crude Oil (Feb) 19.62 0.32  1.66% Heating Oil (Ja=

I want to grab ‘Commodities.’ I’m using this workaround to sed to get the job done.

I’m using Mac OS X 10.7 and GNU sed version 4.2.1. If at the command line I enter

sed ':a;N;$!ba;s/=\r\n//g' ./filename

sed works correctly. However if I run this bash script:

#!/bin/bash


sed ':a;N;$!ba;s/=\r\n//g' filename

sed doesn’t work. However, the same script works under Ubuntu’s command line:

9,650 330,765.0  16.38% NYSE (000) 1,707,915 272,099.0  18.95%     Commodities Close Change % Change Crude Oil (Feb) 19.62 0.32  1.66% Heating Oil (Jan)

On my Mac, the simpler script

#!/bin/bash


sed 's/=//g' filename

successfully removes all the equal signs. I’m trying different combinations of characters to backslash out but without much success. Any hints to what the Mac terminal isn’t liking?

  • 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-16T23:35:01+00:00Added an answer on June 16, 2026 at 11:35 pm

    It’s most likely a PATH setting. /bin/bash uses the default $PATH; not sure why, but perhaps that depends on your normal working shell (is that bash), or in which dot-files your PATH settings are.

    OS X comes with its own (BSD) sed, which is not the same as the GNU one, and thus doesn’t work.
    Running the sed command in the script will pick up the BSD sed, not your self-installed GNU sed. Use the full path to sed in the script, or set $PATH in your script before. Obviously, you don’t have the problem on Ubuntu, since the default sed is GNU.

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

Sidebar

Related Questions

I am trying to parse some text files into a database and there is
I am trying to parse some text and diagram it, like you would a
I'm trying to parse some Text with parsec: data Cmd = LoginCmd String |
I'm trying to parse some UTF-8 encoded html text that contains the left and
I have a string: [\n['-','some text what\rcontains\nnewlines'],\n\n trying to parse: Regex.Split(@[\n['-','some text what contains
Trying to parse an HTML document and extract some elements (any links to text
Trying to parse some XML but apparently this is too much for a lazy
I am trying parse out some text that is in an html file. The
I am trying to parse some Makefile files to read some configs them them
I'm trying to parse some relative large xml-files using the standard sax parser in

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.