0

The content of the file is:

27004700170000000000100002155000000088269044900033XXXX                                    10092019  
27004700170000000000110002555000000123823960900033XXXX                                    10092019  

When I try this command in unix: Show the 1st character in the first line,

sed -n '1p' TEST.TXT|cut -c1

It shows blank

but when I try to show the first character in the second line:-

sed -n '2p' TEST.TXT|cut -c1

It shows '2'.

But when I try to copy paste the file to notepad++ and transfer it to another text file, it will show both the result '2' on the first line and second line. I don't know what part is missing.

I tried cat -A TEST.TXT and it shows the non showing character.

M-oM-;M-?27004700170000000000100002155000000088269044900033XXXX 10092019 ^M$ 27004700170000000000110002555000000123823960900033XXXX 10092019 ^M$

There is a non showing character at the beginning. How can I remove that character in the start of the file?

Ravi Saroch
  • 934
  • 2
  • 13
  • 28
  • Use something like `hd TEST.TXT|head` to see what's **really** in the file. – Armali Oct 11 '19 at 07:52
  • See [Remove file coding mark but preserve its coding](https://stackoverflow.com/questions/27104700/remove-file-coding-mark-but-preserve-its-coding), in particular: they suggest: sed -e '1 s/^.//' file.txt – dash-o Oct 14 '19 at 02:08

0 Answers0