Sponsored Content
Full Discussion: Editing long text file
Top Forums UNIX for Dummies Questions & Answers Editing long text file Post 302974703 by James C on Thursday 2nd of June 2016 12:12:25 PM
Old 06-02-2016
Editing long text file

Good morning all, I have a machine running IRIX and I need to edit a text file on the terminal that is literally thousands of lines. Does anyone know the most efficient way to edit portions of files like these? Obviously simply using the vi command isn't going to work since I get a too many lines error. Thanks a lot, James
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Text Editing

Hello everybody, I have a sorted text file. some of the lines appear twice or even more. is there an unix utility that removes the extra appearences? Thanks, Ido. (7 Replies)
Discussion started by: ginodii
7 Replies

2. Shell Programming and Scripting

How do I strip and add tabbed fields to a long text file?

I was wondering if there was a way to modify a tab delimited text file, up to 185,000 lines long by adding a repeated field to a block of 20 data , then repeat the process until the file is processed. The current file looks like: ... (3 Replies)
Discussion started by: saint65
3 Replies

3. Shell Programming and Scripting

text file editing

Hi, I need some help in text manipulation. I have an input file like this: 7629 "WPCW 19 - CW/AM1, WPCB 40 - FAMN/CORNER, WPCB-DT1 50 - FAMN/CORNER, " W35AW - Various Shopping Pgms W41CF - TBN W47CV - TBN WLLS-LP 49 - AM1 WATCH WPXI 11 N & WPIX 11 CW 1234 "WPCW 19 - CW/AM1,... (26 Replies)
Discussion started by: injeti
26 Replies

4. Shell Programming and Scripting

Editing long records with characters that need to be escaped.

Hi all, I'm new in unix scripting and I've a problem with a script... :confused: I need to read a file, add some fields in the records, and write them in another file, but even when I simply read and write the records, the shell interprets some caracters and the result is that the records... (5 Replies)
Discussion started by: Macs_Linux
5 Replies

5. Shell Programming and Scripting

Text editing script does everything but edit text.

I wrote this script to create and edit a large number of websites based on a template site and a collection of text files which have the relevant strings in them delimited by colons. I run it and the shell doesn't produce any errors, but when it gets to the for loop where it actually has to edit... (2 Replies)
Discussion started by: afroCluster
2 Replies

6. Programming

Editing a specific liine of text file - C++

Is there any way to erase all the contents of a specific line of a text file and then write something on it? e.g. test.txt.old: qwert asdfg zxcbv=0 test.txt.new qwerty asdfg hello=0 is this possible with C++ ?:confused: (1 Reply)
Discussion started by: hakermania
1 Replies

7. Shell Programming and Scripting

editing line in text file adding number to value in file

I have a text file that has data like: Data "12345#22" Fred ID 12345 Age 45 Wilma Dino Data "123#22" Tarzan ID 123 Age 33 Jane I need to figure out a way of adding 1,000,000 to the specific lines (always same format) in the file, so it becomes: Data "1012345#22" Fred ID... (16 Replies)
Discussion started by: say170
16 Replies

8. Shell Programming and Scripting

Help needed editing text file using the terminal

Hi, I have text file with the header like this tracking_id condition replicate FPKM XLOC_000001 alpha 1 10.3199 XLOC_000001 alpha 0 10.3686 XLOC_000001 alpha 2 15.5619 ... With the first column being genes, the second being the condition, the third... (5 Replies)
Discussion started by: 4galaxy7
5 Replies

9. Shell Programming and Scripting

Convert vi editing to text editing

Dear Guru's I'm using Putty and want to edit a file. I know we generally use vi editor to do it. As I'm not good in using vi editor, I want to convert the vi into something like text pad. Is there any option in Putty to do the same ? Thanks for your response. Srini (6 Replies)
Discussion started by: thummi9090
6 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 04:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy