SUMMARY: ASCII File in UNIX

From: <Lisa.Morris_at_victorreinz.com>
Date: Thu, 13 Dec 2001 08:03:18 -0600

Question was:

I have a user who has an Ascii file in UNIX. He would like to convert
this file - or be able to open it and actually look at it (without all of
the symbols in it). Is there some way to do this in UNIX???

Thanks,
Lisa Morris


I received a lot of responses and all of them were extremely helpful - I
learned a lot of commands that I did not know were there....

Thanks for all your responses.

****************************************
# od -a file.name

That "symbols" will display with thier ascii equivalent. You can use -b
and -o instead of -a if you want to look at the numeric character
representations.

******************************************

If you can type a "file [filename]" in your system
and then you get a response like "ASCII text" then
you will be able to do a "vi [filename]" to see
the ASCII text file just as it was typed before.

Then if you woule like to take this strange caracters off
from your file, you can make a copy of this file like this
"cp [originalfile][copiedfilename]".

Then "vi [copiedfilename]".

Then, being inside "vi editor" you can do the
following procedure to take thouse caracters off (replacing them):

1. Press "shift :"
2. At the the bottom, close to the ":" sign, type
   "%s/[yourstrangecharacter//g" then press "Enter"
3. You will see that thouse "notwanted" characters disappear.


****************************************************

Another possibility is to use the Unix 'file' command to see what kind of
file
Unix thinks it is. This looks at the first few bytes for 'magic
characters'
that some software puts at the beginning of a file which indicate the type.

******************************************************

od -c -b filename > filename_od.txt (ascii and octal dump)
or
od -c -h filename > filename_od.txt (ascii and hex dump)
Received on Thu Dec 13 2001 - 14:04:23 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:43 NZDT