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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:54:28+00:00 2026-05-22T23:54:28+00:00

I have this data file, which is supposed to be a normal ASCII file.

  • 0

I have this data file, which is supposed to be a normal ASCII file. However, it has some junk in the end of the first line. It only shows when I look at it with vi or less –>

  y mon d  h XX11 XX22 XX33 XX44 XX55 XX66^@
2011  6 6 10 14.0 15.5 14.3 11.3 16.2 16.1

grep is also saying that it’s a binary file: Binary file data.dat matches

This is causing some trouble in my parsing script. I’m splitting each line and putting them to array. The last element(XX66) in first array is somehow corrupted, because of the junk and I can’t make a match to it.

How to clean that line or the array? I have tried dos2unix to the file and substituting array members with s/\s+$//. What is that junk anyway? Unfortunately I have no control over the data, it’s a third party data.

Any ideas?

  • 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-05-22T23:54:29+00:00Added an answer on May 22, 2026 at 11:54 pm

    Grep is trying to be smart and, when it sees an unprintable character, switches to “binary” mode. Add “-a” or “–text” to force grep to stay in “text” mode.

    As for sed, try sed -e 's/\([^ -~]*\)//g', which says, “change everything not between space and tilde (chars 0x20 and 0x7E, respectively) into nothing”. That’ll strip tabs, too, but you can insert a tab character before the space to include them (or any other special character).

    The “^@” is one way to represent an NUL (aka “ascii(0)” or “\0”). Some programs may also see that as an end-of-file if they were implemented in a naive way.

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

Sidebar

Related Questions

I found this ajax file upload script here http://www.phpletter.com/Demo/AjaxFileUpload-Demo/ Which is supposed to add
I have an iphone app which has an NSURLConnection downloading a large video file.
Consider a normal PHP image upload functionality (not using AJAX) and there occurs this
I am new to VC++ and programming. I have a task in which I
I have a Data Access Layer library that I would like to make portable.
I really need help with filling in data in a Table View, where my
Django 1.1.2 & Python 2.6.5 I keep getting this error when executing a seemingly
I am just beginning to start learning web application development, using python. I am
UPDATE : Once I looked at the problem in Firebug, I found my mistake
I am a nurse and I know python but I am not an expert,

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.