LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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-07-2014, 04:48 PM   #1
socalheel
Member
 
Registered: Oct 2012
Location: Raleigh, NC
Distribution: CentOS / RHEL
Posts: 158

Rep: Reputation: 3
append lines to specific line numbers


what's the best way to cat a file and append the contents into another file at specific line numbers?

i know i can do it with sed, but i'm only experienced with doing one line at a time.

here is my goal.

i need to add this:

Code:
<IfModule mod_fcgid.c>
FcgidBusyTimeout 3600
FcgidIOTimeout    600
</IfModule>
starting at line 1002 in httpd.conf
 
Old 07-07-2014, 05:01 PM   #2
socalheel
Member
 
Registered: Oct 2012
Location: Raleigh, NC
Distribution: CentOS / RHEL
Posts: 158

Original Poster
Rep: Reputation: 3
never mind, found it:

Code:
sed -i '1002r inputfile.txt' httpd.conf
 
  


Reply



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
SED append to a specific range of lines of a file Gener@l Programming 6 04-24-2013 06:56 PM
[SOLVED] search for specific <Directory> directive in httpd.conf and then append line bradvan Programming 6 12-20-2012 08:22 AM
print lines form nth line to mth line which fulfill specific condition cristalp Programming 4 11-07-2011 07:39 AM
[SOLVED] append variable string in a specific line himu3118 Programming 4 06-08-2010 08:49 AM
[SOLVED] Trying to number every other line and append those numbers to end of line kmkocot Programming 7 04-23-2010 11:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:05 PM.

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
Open Source Consulting | Domain Registration