LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 07-26-2011, 02:51 AM   #1
sunilsagar
LQ Newbie
 
Registered: Jul 2011
Posts: 29

Rep: Reputation: Disabled
Insert paragraph at particular line


Hello,

I want to copy below content to a file after line 200.

Alias /A/ "/A/B/C/D/"
<Directory "/E/F/G/H/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

AliasMatch /A/B/[0-9]+/(.*) "/E/F/G/$1"
<Directory "/I/J/K/$1">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /A/B/ "/A/B/C/D/"
<Directory "/A/D/E/F/">
Options Indexes MultiViews ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /A/B/ "/C/D/E/F/"
<Directory "/G/H/I/J/">
Options Indexes MultiViews ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>


ScriptAlias /A-B/ "/C/D/E/F-G/"
Scriptsock


Or is it possible if I can copy this content in some other file and insert to the main file.

Thanks
Sunil
 
Old 07-26-2011, 03:07 AM   #2
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware64 14.1
Posts: 401

Rep: Reputation: 153Reputation: 153
Use the include directive.

Note: I'm assuming, based on your post, that you're using httpd, right?

Last edited by Diantre; 07-26-2011 at 03:08 AM.
 
Old 07-26-2011, 06:11 AM   #3
sunilsagar
LQ Newbie
 
Registered: Jul 2011
Posts: 29

Original Poster
Rep: Reputation: Disabled
Good catch,

this is apache file, but cannot use include here.
due to some reason have to modify the same file.
 
Old 07-26-2011, 06:17 AM   #4
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Code:
sed -i.bck '200r file_to_insert' file
 
Old 07-27-2011, 11:33 PM   #5
sunilsagar
LQ Newbie
 
Registered: Jul 2011
Posts: 29

Original Poster
Rep: Reputation: Disabled
thanks so much .. it worked
sed -i.bck '200r file_to_insert' file
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Insert line using sed or awk at line using line number as variable sunilsagar Programming 11 02-03-2012 11:48 AM
How do I insert a line/value after a particular line, in file with sed Glenn D. Programming 3 01-21-2010 10:14 PM
insert a line or a file to /etc j-me Linux - Newbie 9 07-23-2009 02:47 PM
search for paragraph marks or line ends in openoffice? lugoteehalt Linux - Software 3 12-06-2005 01:46 PM
Converting a paragraph into a one-line string ganninu Linux - General 4 12-03-2003 08:50 AM


All times are GMT -5. The time now is 01:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration