LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 12-12-2012, 07:57 AM   #1
graziano1968
Member
 
Registered: Sep 2004
Posts: 223

Rep: Reputation: 30
data file issue


Hello

I have this file

/etc/spoofdata

If I execute this ...

$ cat /etc/spoofdata
127.0.0.1

BUT if I open with pico or nano I see this
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@127.0.0.1

which could be the cause and how to remove those ^@ ?

Thank you
 
Old 12-12-2012, 08:12 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 778
Blog Entries: 2

Rep: Reputation: 199Reputation: 199
looks like binary data in the file - try "od"
 
Old 12-12-2012, 08:17 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
To check what sort of file /etc/spoofdata is:
Code:
file /etc/spoofdata
 
Old 12-12-2012, 08:21 AM   #4
graziano1968
Member
 
Registered: Sep 2004
Posts: 223

Original Poster
Rep: Reputation: 30
I received this

/etc/spoofdata: data

I need to convert it to

/etc/spoofdata: ASCII text

how to do that ?

Last edited by graziano1968; 12-12-2012 at 08:23 AM.
 
Old 12-12-2012, 08:26 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by graziano1968 View Post
I received this

/etc/spoofdata: data
This isn't a text file.

Quote:
what is wrong ?
Nothing is wrong. A lot of Unix/Linux tools are for dealing with text files and not data/binary files. cat is one of those tools.

od can give you a dump of data/binary files, strings can dump printable characters. Have a look at both man pages for details.
 
Old 12-12-2012, 08:28 AM   #6
graziano1968
Member
 
Registered: Sep 2004
Posts: 223

Original Poster
Rep: Reputation: 30
really lost at this point

is there any fast way to convert

/etc/spoofdata: data

to

/etc/spoofdata: ASCII text

thank you
 
Old 12-12-2012, 08:33 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Before you start tampering with that specific file you need to ask yourself why this file is a data file. Did you create it yourself? was it generated by the system?

If you created it yourself you can delete the file and create a new one using an editor (vi(m)/emacs/gedit/..).
If this file was created by the system then you shouldn't tamper with it, it has this data format for a reason.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I am getting binary data in file.but i want normal data .PLEASE HELP batman4 Programming 7 07-24-2012 07:53 AM
Over my head with this problem - Access the data in .fbd data file BobNutfield Linux - Server 3 02-20-2011 01:48 PM
Replace data of one column with data on other file corresponding to transaction ID saurabhmehan Linux - Newbie 1 12-23-2010 01:19 AM
gnuplot, pull X data from file, specify Y data at cmd line? hedpe Programming 5 03-15-2007 11:32 PM
Issue tarring data Johnny Mac Linux - Newbie 5 11-12-2004 02:58 PM


All times are GMT -5. The time now is 01:48 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration