Hidden characters when pasting in vi/vim

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Hidden characters when pasting in vi/vim
# 1  
Old 12-02-2016
Hidden characters when pasting in vi/vim

Hello everyone.

When I copy some configuration settings string from MS_Word to putty from my personal pc to a remote machine, it appears that I copy some hidden symbols, which at first, cannot be seen and appear as hidden. Some java programs did not start, and after investigation I found that:

- After I use cat -vt config.file hidden symbol is revealed. In vi mode, I tried using :set list with no success, so in vi mode everything appears as copied normally but the hidden symbol cannot be seen.

Is there a way to see directly in vi, if I have copied such hidden symbols? Maybe I should change my putty's font?

Additional info
I am using W10 with standard English language settings. Strange thing is that I copy the same text to a notepad++ and with an ansi encoding, it does not get detected also, when I change it to utf-8, the hidden symbol appears.

Thanks in advance for everyone`s time and attention.

Last edited by rbatte1; 12-02-2016 at 12:06 PM.. Reason: Added ICODE tags for inline code snippets
# 2  
Old 12-02-2016
It generally is not a good idea to edit *nix configuration files on windows systems, and even less so with WORD, as it will stuff the file with formatting info on top of MS's DOS line terminators (\r or 0x0D) found in any text files.
Use text editors instead, of which some can be switched to "UNIX" mode, so you wouldn't need to worry.
You're best off if you edit text files intended for *nix systems on the target host.
# 3  
Old 12-02-2016
Hi RudiC, thanks for the answer. I generally avoid editing nix files on Windows, although If I happen to do it, I use dos to unix file converter app.
However, in this particular case, I just copy random string from my system to a remote system via putty and vi editor.

By the way, which editors would you recommend that can switch to unix mode?
# 4  
Old 12-02-2016
I'm running a windows-free environment, so I can't really help. Quite some time ago, I was very happy using "EDITPAD Lite".

To remove undesired characters from a file that go beyond the action of the dos2unix tool, there exist different tools and approaches, e.g.
Code:
tr -dc '[[:alnum:][:punct:][:space:]]' <file

, or a quick sed or awk script.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh hidden characters in variables

Hi. I'm getting the following hidden characters \uat the start of a string after I pass in variables from the command line. I only noticed this when I set -x in my KSH script. Can anybody tell me how this happens and how to remove them? Many thanks. + STR=$'\uusername testuser1' + print... (12 Replies)
Discussion started by: user052009
12 Replies

2. Shell Programming and Scripting

Rsync - how to copy hidden folder or hidden files when using full path

Hello. I use this command : rsync -av --include=".*" --dry-run "$A_FULL_PATH_S" "$A_FULL_PATH_D"The data comes from the output of a find command. And no full source directories are in use, only some files. Source example... (2 Replies)
Discussion started by: jcdole
2 Replies

3. Shell Programming and Scripting

How to see hidden characters.....

I know that cat -v will show me hidden characters in a file.... I for some reason seem to think that there's a bash command that will show me hidden characters in a variable in a script? Or am I just imagining it? Thanks in advance (8 Replies)
Discussion started by: Bashingaway
8 Replies

4. Shell Programming and Scripting

hidden characters added to commands

Hello everybody. Im really new in shell scripting. Im working with RedHat 4. I have begin to do some scripts to test the posibilitys but Im fancing a disturbing problem. some times the lines that I write add the return character or end-of-file ascii character to the command or argument tha... (2 Replies)
Discussion started by: josebenitez
2 Replies

5. UNIX for Dummies Questions & Answers

Vim help - delete words in a file or characters after pattern

I have a file with words that begin with character #. Whenver that character is found that word should be deleted throughout the file. How do I do that in VIM. e.g: afkajfa ladfa ljafa #222222 kjafad ljl afajkj kjlj uouu #44444 jlkj lkjl Output should be afkajfa ladfa ljafa kjafad... (1 Reply)
Discussion started by: osbourneric
1 Replies

6. Shell Programming and Scripting

Hidden control characters in a Unix Text File!

Can anyone seem to know how to find out whether a UNIX text file has 'hidden' control characters? Can I view them using 'vi' by some command line options? If there are control characters in a text file which are invisible/hidden.. then how do I get rid of them? Your intelletual answers are... (6 Replies)
Discussion started by: kewl_guy
6 Replies

7. UNIX for Advanced & Expert Users

hidden Characters

Hello All, I'm trying to parse through a file and display all the hidden characters, including all carriage and line returns. I usually use cat -v, but this doesn't display the carriage and line returns. Does anyone know how this can be done? Thanks Khoom (5 Replies)
Discussion started by: Khoomfire
5 Replies

8. UNIX for Advanced & Expert Users

Hidden Characters

Hello all, I have two files, that I suspect may contain hidden characters (EG, three spaces instead of a tab). Does anyone know of any tool that can display this (I have tried using diff, but I'm not quite sure it would do the job) (6 Replies)
Discussion started by: Khoomfire
6 Replies

9. UNIX for Dummies Questions & Answers

missing hidden characters

I made a small change to a UNIX script. When I tried to run it I received the following message: /bin/ksh: ^M: not found /bin/ksh: ^M: not found /bin/ksh: ^M: not found As ^M is a non printing character, I don't know how to discover where it is missing. How can I correct thiis... (2 Replies)
Discussion started by: SUSANR9999
2 Replies
Login or Register to Ask a Question