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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
deleting lines from multiple text files vrms Shell Programming and Scripting 3 04-25-2008 12:01 PM
retrieved multiple lines on multiple places in a file dala Shell Programming and Scripting 8 03-14-2008 03:28 PM
trying to count lines in multiple files llsmr777 UNIX for Dummies Questions & Answers 1 01-23-2008 01:52 PM
How can I replace multiple lines from different files ranga27 Shell Programming and Scripting 2 02-07-2007 08:57 PM
Adding 3 Lines to Multiple c and h files with perl Lazzar Shell Programming and Scripting 2 10-28-2003 01:30 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 06-04-2008
dayinthelife dayinthelife is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 6
Adding Multiple Lines to Multiple Files

Hello,

I have three lines I need to add to hundreds of files. The files are all in the same format and contain the same information. I want to add the same information to the files.

The new lines of information are similar. Here is an example of the three lines:

line1:
line2 = text1
line3 = text2


They all should be on line 34, 35 and 36. Line 2 and 3 are right justified by 3 spaces.

The files all start with the same name separated by a period followed by some random number.

name1.number1

If someone can help me create a script, I would be very much appreciative.

Thank you,

dayinthelife
  #2 (permalink)  
Old 06-04-2008
mrmod mrmod is offline
Registered User
  
 

Join Date: May 2008
Posts: 2
you could put the lines in a file like 'mylittlelines' then for the directory where all these files are

for file in *
do
cat mylittlelines >> $file
done

or use find with something like
for file in find . -name <pattern>
do
cat mylittlelines >> $file
done
  #3 (permalink)  
Old 06-04-2008
dayinthelife dayinthelife is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 6
Thank you!!

That worked great and such a simple script, if you know what you are doing.

Thanks again!

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 06:55 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