Problem inserting text into file after specific line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem inserting text into file after specific line
# 1  
Old 03-15-2009
Problem inserting text into file after specific line

this is utterly embarassing Smilie

after posting here i revisited my files and found that when i used "vi" instead of a gui based editor, i suddenly found that the indentations were in fact wrong Smilie

sorry about this Smilie

Last edited by mocca; 03-15-2009 at 07:22 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

2. Shell Programming and Scripting

Commenting a specific line and inserting a new line after commented line.

Hello All, I have following file contents cat file #line=aaaaaa #line=bbbbbb #line=cccccc #line=dddddd line=eeeeee #comment=11111 #comment=22222 #comment=33333 #comment=44444 comment=55555 Testing script Good Luck! I would like to comment line line=eeeeee and insert a new line... (19 Replies)
Discussion started by: manishdivs
19 Replies

3. Shell Programming and Scripting

Inserting file after specific line in another file

Im attempting to insert the contents of File1 at a specific point of File2. File1 AD004 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 File2 AA001 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 AB002 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 AC003 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 Result AA001 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1... (13 Replies)
Discussion started by: ncwxpanther
13 Replies

4. Shell Programming and Scripting

script for inserting line at specific place in file

I use zentyal for my server admin, which is great but zentyal auto-generates config file on boot and hence overwrites any changes made directly to config files. In order to allow multiple user access to a MS ACCESS database, I need to customise the smb.conf file and add the following line to the... (9 Replies)
Discussion started by: barrydocks
9 Replies

5. Linux

Get a specific line number from a text file

Hello! All, Could you please tell me how to get a specific line number from a text file? For example below, ABC DEF ---> Get this line number, return to an variable GHI My OS is Linux. Thank you so much for your help in advance! (3 Replies)
Discussion started by: barryxian
3 Replies

6. UNIX for Dummies Questions & Answers

Inputting text to a specific line of a file

Hi all, I have a script which uses a basic line to add text into another file e.g. grep -i test * >> test.txt Is there a way I can get the output of the grep to output to a specific line in the text.txt for example output above the line starting "Bottom line..." (6 Replies)
Discussion started by: JayC89
6 Replies

7. Shell Programming and Scripting

Reading data from a specific line in a text file

Hello, I have a problem which is giving me headache for days, can some please help. Please see code and text fiel below. Please see text in red for the problem I am facing # Program gets an input x from user while read line ; do echo... (4 Replies)
Discussion started by: jermaine4ever
4 Replies

8. Shell Programming and Scripting

Modify Specific Line of a Text File

Given a text file, how do you add a line of text after a specific line number? I believe I would want to use "sed" but I am unsure of the syntax. Thank you. Mike (5 Replies)
Discussion started by: msb65
5 Replies

9. Shell Programming and Scripting

Adding specific text and spaces to each line in a text file

Hi, I wanted to add specific text to each row in a text file containing three rows. Example: 0 8 7 6 5 5 7 8 9 0 7 9 7 8 9 0 1 2 And I want to add a 21 at the beginning of the first row, and blank spaces at the beginning of the second two rows. To get this: 21 0 8 7 6 5 5 7 8... (4 Replies)
Discussion started by: hertingm
4 Replies

10. Programming

jumping to a specific line in a text file

hi everybody! i need to read a specific line from a text file using C. can any one suggest how to do it. i m aware abt fread(), fwrite(), fseek()... but using these allows the pointer to be moved 1 character at a time. Is there a way i could jump directly to a line if i know the line number?... (4 Replies)
Discussion started by: mridula
4 Replies
Login or Register to Ask a Question
ex(1)							      General Commands Manual							     ex(1)

Name
       ex, edit - text editor

Syntax
       ex [ - ] [ -v ] [ -x ] [ -t tag ] [ -r ] [ +command ] [ -l ] name...
       edit [ ex options ]

Description
       The  editor  is	the  root  of a family of editors: and The editor is a superset of with the most notable extension being a display-editing
       facility.  Display-based editing is the focus of

       The name argument indicates the files to be edited.

Options
       -    Suppresses all interactive-user feedback.  This option is useful in processing editor scripts in command files.

       -v   Equivalent to using rather than

       -t   Equivalent to an initial tag command, that is, editing the file containing the tag and positioning the editor at its definition.

       -r   Used to recover after an editor or system crash.  It recovers by retrieving the last saved version of the named file.  If no  file	is
	    specified, it displays a list of saved files.

       -R   Sets the read-only option at the start.

       +command
	    Indicates  that  the editor should begin by executing the specified command.  If the command is omitted, it defaults to $, positioning
	    the editor at the last line of the first file, initially.  Other useful commands here are scanning patterns of the form  +/pattern	or
	    line numbers.

       -l   Sets up for LISP.  That is, it sets the showmatch and lisp options.  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 them.

Restrictions
       The command causes all marks to be lost on lines changed and then restored if the marked lines were changed.

       The command does not clear the buffer modified condition.

       The z command prints a number of logical rather than physical lines.  More than a screenful of output may result if long lines are present.

       File input/output errors do not print a name if the command line minus sign (-) option is used.

       There is no easy way to do a single scan ignoring case.

       The editor does not warn you if you place text in named buffers and do not use it before exiting the editor.

       Null characters are discarded from input files, and cannot appear in output files.

Files
       /usr/lib/ex?.?recover	     recover command
       /usr/lib/ex?.?preserve	     preserve command
       /etc/termcap		terminal capabilities
       ~/.exrc			editor startup file
       /tmp/Exnnnnn		editor temporary
       /tmp/Rxnnnnn		named buffer temporary
       /usr/preserve		preservation directory

See Also
       awk(1), ed(1), grep(1), sed(1), vi(1), termcap(5), environ(7)
       "Edit: A Tutorial" and the "Ex Reference Manual" in the
       Supplementary Documents, Volume 1: General User

																	     ex(1)