Hidden special character


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Hidden special character
# 1  
Old 08-22-2016
Hidden special character

Hi,

Anyone can help with my problem, I have an issue with hiddend special character each line of my file.

When I open the file using vim

#test.txt
Code:
aaa
bbb
ccc

Inside the vim I command :set list, and then the list would become

#test.txt
Code:
aaa$
bbb$
ccc$

How to remove the hidden white spaces "$" using sed command.

Thank you in advance.

Regards,
FSPalero

Last edited by Don Cragun; 08-22-2016 at 10:26 PM.. Reason: Add CODE and ICODE tags.
# 2  
Old 08-22-2016
There are no hidden white spaces. When using list mode in vim, the $ at the end of the line in the output indicates the position of the <newline> character terminating the line. In list mode, spaces appear as spaces, tabs appears on the screen as the two character sequence ^I and a <carriage-return> character would appear on the screen as the two character sequence ^M.
# 3  
Old 08-22-2016
set list highlights white space characters - one of which is \n the newline character.

There are no hidden spaces based on your display.
To verify try:

Code:
od -d test.txt

This command displays EVERY character in a file.

-- oops Don types faster than I do.
# 4  
Old 08-23-2016
An alternative to using od is cat -vET or cat -A. This will show all non-printing characters, tab characters and line-ends; I think the set list command in vi just shows the line ends and tab characters.

Andrew
# 5  
Old 08-23-2016
Quote:
Originally Posted by apmcd47
An alternative to using od is cat -vET or cat -A. This will show all non-printing characters, tab characters and line-ends; I think the set list command in vi just shows the line ends and tab characters.

Andrew
Hi Andrew,
No, the standards say that the list command in vi and ex causes <newline> characters to be displayed as a <dollar-sign> at the end of the line they terminate, the <backslash> character as two <backslash> characters, and other non-printable or control characters to be displayed as backslash escape sequences.

I have seen some versions of ex, vi, and vim that print control characters (other than <newline>) as the two character sequence ^x where x is the key on the keyboard that would be pressed while the control key is being held down that would produce that character (instead of printing the backslash escape sequences required by the standards), but I haven't seen any version of ex, vi, or vim that fails to print non-printable characters as identifiable character sequences when printing in list mode.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Special character $$

Hi, on ksh What does the following do? grep -v "toolbox" $home_oracle/.profile >$home_oracle/.profile.$$ Thanks. Please use CODE tags as required by forum rules! (3 Replies)
Discussion started by: big123456
3 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

Finding Special Character in Vi

Hi, I have special characters in a file in unix which has many xml messages that comes from Messaging Queue. The loading process to the database failed due to special characters. Initially I could not able to detect it when I copy/paste in Windows editor as each line has more than 1000... (11 Replies)
Discussion started by: bobbygsk
11 Replies

4. Shell Programming and Scripting

Vi special character

When editing a file, vi displays a special character as ^L. Can you tell me the escaped character to be used in awk? And can that escaped character be used in a regexp in both sed and awk? (7 Replies)
Discussion started by: dmesserly
7 Replies

5. Shell Programming and Scripting

Deleteing one character after an special character

I have below line in a unix file, I want to delete one character after "Â". 20091020.Non-Agency CMO Daily Trade Recap Â~V Hybrids The result should be : 20091020.Non-Agency CMO Daily Trade Recap  Hybrids i dont want to use "~V" anywhere in the sed command or any other command, just remove... (1 Reply)
Discussion started by: mohsin.quazi
1 Replies

6. Shell Programming and Scripting

Special character \

Hi, In the shell script, i need to remove the special charater "\" with "\\". For example, i need to replace "D:\FXT\ABC.TXT" with "D:\\FXT\\ABC.TXT". However, when trying to do something like , i get the below error :- -->echo "D:\FXT\ABC.TXT" | sed -e 's#\#\\#g' sed: 0602-404 Function... (7 Replies)
Discussion started by: amit_arora
7 Replies

7. UNIX for Advanced & Expert Users

grep in special character

All, I am trying to grep "-----" from a test when i use this i am getting the below error. What is the reason for this ?????... How can i over come this ##) echo "----------------- test_sys_job -----------------" | grep "-----------------" grep: illegal option -- - grep: illegal... (6 Replies)
Discussion started by: arunkumar_mca
6 Replies

8. Shell Programming and Scripting

special character

Hi, I am trying to unload file from a database. Which contains few lines with the character below. Rest of the data was unloaded appropriately. a) What does this below character means? b) How can i remove it, I already have sed '/^$/d' c) Will this effect the file by any means... (4 Replies)
Discussion started by: tostay2003
4 Replies

9. Programming

special character ?

hey there im a bit stuck on executing commands that include the special character '?'. can someone recommend a way on how i would be able to execute it?? i thought the glob function could be useful (still mite be) but upon entering the command 'ls pars?' it listed all the files in the... (1 Reply)
Discussion started by: mile1982
1 Replies
Login or Register to Ask a Question