how to see hidden char in file

some times you transfer files from windows to Linux or UNIX using binary method, you will find some hidden characters  on the file, to display these hidden character  use commands “cat” with option “vte” see the following examples:

the first example without options

[root@Linux1 ~]# cat  script.sh
#!/bin/sh
for i in `ls -l /`
do
echo $i
done

and this one with “VTE” option

[root@Linux1 ~]# cat -vte script.sh
#!/bin/sh^M$
for i in `ls -l /`^M$
do^M$
echo $i^M$
done^M$

the end line must be “$”, and you will notice the hidden characters “^M”. to remove this hidden character see the following LINK:
http://how-2-know.com/main/2013/01/28/removing-control-characters/

This entry was posted in AIX, Linux, Shell Script, Solaris and tagged , , , , , . Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.