The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to add a single line to middle of text file. progkcp Shell Programming and Scripting 2 05-12-2008 11:44 AM
How to insert text in the middle of a file kartikkumar84@g UNIX for Dummies Questions & Answers 6 05-10-2008 11:35 AM
insert text in the middle of a file relle Shell Programming and Scripting 3 03-13-2008 12:37 PM
Insert text file at a certain line. insania Shell Programming and Scripting 4 07-31-2006 11:46 PM
insert text into the middle of a original file mopimp Shell Programming and Scripting 1 03-26-2006 07:11 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 03-05-2007
Registered User
 

Join Date: Mar 2007
Posts: 4
How to insert text into first line of the file and middle of the file?

Script 1
Pre-requisites
Create a file with x amount of lines in it, the content of your choice.

Write a script that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the first line) of the file named in your second argument.

Note! The file must retain the original name

Script 2

Take a copy (backup) and amend the above script so that it now inserts the first argument into the middle of the file.
Forum Sponsor
  #2  
Old 03-05-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
No homework questions please. Read the rules. Rule #6 in particular. Thread locked.
  #3  
Old 03-05-2007
Registered User
 

Join Date: Mar 2007
Posts: 4
How to add string(without sed&awk )to first line of the file and middle of the file?

Script 1
Pre-requisites
Create a file with x amount of lines in it, the content of your choice.

Write a script that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the first line) of the file named in your second argument.

Note! The file must retain the original name

Script 2

Take a copy (backup) and amend the above script so that it now inserts the first argument into the middle of the file.
  #4  
Old 03-05-2007
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,609
just now similiar thread was closed
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0