The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell scripting adding text to top of file meadhere UNIX for Dummies Questions & Answers 7 07-05-2007 09:31 AM
adding a line to a file andy2000 Shell Programming and Scripting 2 03-26-2007 08:44 AM
adding text to a file between lines bishweshwar Shell Programming and Scripting 7 10-10-2006 01:03 PM
adding text to end of each line in a file cubs0729 Shell Programming and Scripting 2 11-10-2005 01:02 PM
Changing the column for a row in a text file and adding another row aYankeeFan Shell Programming and Scripting 9 05-02-2005 09:42 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-08-2005
cubs0729 cubs0729 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 31
Adding Text To each line of a file

How would I add text to the beginning of each line in a text file in a script right after the file is created from another text file.
  #2 (permalink)  
Old 09-08-2005
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Code:
/bin/echo '%s/^/newText/g\nwq!' ex - myTextFile
  #3 (permalink)  
Old 09-08-2005
cubs0729 cubs0729 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 31
please elaborate

I want to understand, not just use it. Yet I still can't get mine to work.

This is what I have ...

echo '%s/^/mrtsnc01/g\nwq!' ex - $ofile

what needs to be changed????
  #4 (permalink)  
Old 09-08-2005
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Quote:
Originally Posted by cubs0729
I want to understand, not just use it. Yet I still can't get mine to work.

This is what I have ...

echo '%s/^/mrtsnc01/g\nwq!' ex - $ofile

what needs to be changed????
sorry - I missed the pipe:
Code:
/bin/echo '%s/^/newText/g\nwq!' | ex - myTextFile
give a full path to 'echo' - in order to avoid ksh's builtin 'echo'
  #5 (permalink)  
Old 09-08-2005
cubs0729 cubs0729 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 31
Thank you So much

thank you so so much, you saved my a$$.

Last edited by vgersh99; 09-08-2005 at 04:51 PM.. Reason: profanity?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:19 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0