Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to enter special characters in a text file using vi? Post 302955256 by newbie_01 on Tuesday 15th of September 2015 07:15:37 PM
Old 09-15-2015
How to enter special characters in a text file using vi?

Hi,

I need to create a test text file with the special characters \342\200\223 in it and to be able to use sed maybe to delete them

I tried doing it using vi by pressing CTRL-V and then typing 342 but it does not work. After pressing CTRL-V and typing 342 it seems to just insert the numbers 342 in it, tried doing CTRL-V and then \342 does not work either.

Eventually, I would want to search and delete all non-printable characters but at the moment, this is what I am wanting to test on as these characters appear intermittently in a file that I am trying to load into the database.

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to see special characters in a file using vi

Hi, I have a file which has special characters. I can't see them when I "vi" the file. But I am sure there are some special un seen characters. How can I see them? Please help. Thx (6 Replies)
Discussion started by: jingi1234
6 Replies

2. Shell Programming and Scripting

remove special characters from text using PERL

Hi, I am stuck with a problem here. Suppose i have a variable which is assigned some string containing special charatcers. for eg: $a="abcdef^bbwk#kdbcd@"; I have to remove the special characters using Perl. The text is assigned to the variable implicitly. How to do it? (1 Reply)
Discussion started by: agarwal
1 Replies

3. Shell Programming and Scripting

sed usage with special characters - text manipulation

I'm trying to use sed to replace string in text file but I've some problems with slash and new-line for example I have to replace this string: \> signal_rssi=" or this string where new-line is in the middle of the string: " /> I'm using this code for the first case but it doesn't... (10 Replies)
Discussion started by: TheMrOrange
10 Replies

4. Shell Programming and Scripting

Remove special characters from text file

Hi All, i am trying to remove all special charecters().,/\~!@#%^$*&^_- and others from a tab delimited file. I am using the following code. while read LINE do echo $LINE | tr -d '=;:`"<>,./?!@#$%^&(){}'|tr -d "-"|tr -d "'" | tr -d "_" done < trial.txt > output.txt Problem ... (10 Replies)
Discussion started by: kkb
10 Replies

5. Shell Programming and Scripting

Adding text to file on certain lines with(special characters)

I need to add "new lines" of text with special characters, to specific lines in the file. There are 3 modifications needed. Been testing 2 here without success. #!/usr/bin/perl use FileHandle; $file=FileHandle->new; $FILENAME="/opt/etc/usr/file.txt"; $file->open ("<$FILENAME") or die... (13 Replies)
Discussion started by: A4ron4perl
13 Replies

6. UNIX for Dummies Questions & Answers

find text enclosed between special characters

Hi, I'm trying to find all DISTINCT words having _mr in the line and ENCLOSED in '/'. For eg below is the text in a file.. /database/new_mr254/1 /database/rawdb/views/new_mr254/1 /database/project/rawdb/tables/new_mr232/1 /database/project/rawdb/views/new_mr253/1... (5 Replies)
Discussion started by: northwest
5 Replies

7. Shell Programming and Scripting

File containing special characters

Hello All, I am facing challenges in order to transfer a file from windows to unix box,the file contains a special character '×' ,now when I am transferring the file from windows to unix that special character converted to something else like 'Ã' ,another thing I have noticed that the hardware is... (1 Reply)
Discussion started by: prarat
1 Replies

8. Shell Programming and Scripting

Remove Special Characters Within Text

Hi, I have a "|" delimited file that is exported from a database. There is one column in the file which has description/comments entered by some application user. It has "Control-M" character and "New Line" character in between the text. Hence, when i export the data, this record with the new... (4 Replies)
Discussion started by: tarun.trehan
4 Replies

9. UNIX for Dummies Questions & Answers

Search special characters in a file and replace with meaningful text messages like Hello

Search special characters in a file and replace with meaningful text messages like Hello (2 Replies)
Discussion started by: raka_rjit
2 Replies

10. UNIX for Beginners Questions & Answers

Rename File Name with Special Characters

I am trying to rename files with spaces and other characters and not able to be successful. FileNames: UPLOAD REFERENCE.xls UPLOAD MASS REFERENCE.XLS find /UPLOAD REFERENCE/ -depth -type f -name "* *" -exec rename " " "_" "{}" ";" The above one is successful to replace spaces... (1 Reply)
Discussion started by: eskay
1 Replies
vi(1)							      General Commands Manual							     vi(1)

Name
       vi - screen editor

Syntax
       vi [ -t tag ] [ +command ] [ -l ] [ -r ] [ -wn ] [ -x ] name...

Description
       The  (visual)  editor is a display-oriented text editor based on The command and the command run the same code.	You can access the command
       mode of from within

       The following is a list of some of the commands.  See the vi Beginner's Reference Card and "An Introduction to Display Editing with vi"	in
       the Supplementary Documents, Volume 1: General User for more details on using

       Screen Control Commands

	    <CTRL/L>	 Reprints current screen.

	    <CTRL/Y>	 Exposes one more line at top of screen.

	    <CTRL/E>	 Exposes one more line at bottom of screen.

       Paging Commands

	    <CTRL/F>	 Pages forward one screen.

	    <CTRL/B>	 Pages back one screen.

	    <CTRL/D>	 Pages down half screen.

	    <CTRL/U>	 Pages up half screen.

       Cursor Positioning Commands

	    j		 Moves cursor down one line, same column.

	    k		 Moves cursor up one line, same column.

	    h		 Moves cursor back one character.

	    l		 Moves cursor forward one character.

	    <RETURN>	 Moves cursor to beginning of next line.

	    0		 Moves cursor to beginning of current line.

	    $		 Moves cursor to end of current line.

	    <SPACE>	 Moves cursor forward one character.

	    nG		 Moves cursor to beginning of line n.  Default is last line  of file.

	    /pattern	 Moves cursor forward to next occurrence of pattern.

	    ?pattern	 Moves cursor backward to next occurrence of pattern.

	    n		 Repeats last / or ? pattern search.

       Text Insertion Commands

	    a		 Appends text after cursor. Terminated by <ESC>.

	    A		 Appends text at the end of the line. Terminated by <ESC>.

	    i		 Inserts text before cursor. Terminated by <ESC>.

	    I		 Inserts text at the beginning of the line. Terminated by <ESC>.

	    o		 Opens new line below the current line for text insertion.  Terminated by <ESC>.

	    O		 Opens new line above the current line for text insertion.  Terminated by <ESC>.

	    <DELETE>	 Overwrites last character during text insertion.

	    <ESC>	 Stops text insertion.

       Text Deletion Commands

	    dw		 Deletes current word.

	    x		 Deletes current character.

	    dd		 Deletes current line.

	    D, d$	 Deletes from cursor to end of line.

	    P		 Puts back text from the previous delete.

       Text Change Commands

	    cw		 Changes characters of current word until stopped with escape key.

	    c$		 Changes text up to the end of the line.

	    C, c$	 Changes remaining text on current line until stopped by pressing the escape key.

	    ~		 Changes case of current character.

	    xp		 Transposes current and following characters.

	    J		 Joins current line with next line.

	    rx		 Replaces current character with x.

       Buffer Usage Commands

	    [a-z]n yy	 Yanks n lines to the [a-z] buffer.  Default is current line.

	    [a-z]n p	 Puts n yanked text lines from the a-z buffer, after the cursor.

       Exiting vi

	    ZZ		 Exits and saves changes

	    :wq 	 Writes changes to current file and quits edit session.

	    :q		 Quits edit session (no changes made).

       The command uses all of the same edit or commands as However, does not allow you to write the file. See

Options
       -t tag	 Specifies a list of tag files.  The tag files are preceded by a backslash () and are separated by spaces.  The tag option should
		 always be the first entry.

       +command  Tells the editor to begin by executing the specified command.	A useful example would be +/pattern to search for a pattern.

       -l	 Sets the showmatch and lisp options for editing LISP code.

       -r name	 Retrieves the last saved version of the name'd file in the event of an editor or system crash.  If no file is specified,  a  list
		 of saved files is produced.

       -wn	 Sets  the default window size to n.  This option is useful for starting in a small window on dialups.	The -x option is available
		 only if the Encryption layered product is installed.

       -x	 Causes to prompt for a key.  The key is used to encrypt and decrypt the contents of the file. If  the	file  contents	have  been
		 encrypted with one key, you must use the same key to decrypt the file.

Restrictions
       Software tabs using ^T work only immediately after the autoindent.

       Left and right shifts on intelligent terminals do not make use of insert and delete character operations in the terminal.

       The  wrapmargin option sometimes works incorrectly because it looks at output columns when blanks are typed.  If a long word passes through
       the margin and onto the next line without a break, then the line is not broken.

       Insert/delete within a line can be slow if tabs are present on intelligent terminals, since the terminals need  help  in  doing	this  cor-
       rectly.

       Saving text on deletes in the named buffers is somewhat inefficient.

       The  source  command does not work when executed as :source; there is no way to use the :append, :change, and :insert commands, since it is
       not possible to give on a :global you must Q to command mode, execute them, and then reenter the screen editor with or

See Also
       ed(1), ex(1), view(1)
       The Little Gray Book: An ULTRIX Primer
       The Big Gray Book: The Next Step with ULTRIX
       "An Introduction to Display Editing with Vi", Supplementary Documents, Volume 1: General User

																	     vi(1)
All times are GMT -4. The time now is 11:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy