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
how to retreive a block of data from the file aoussenko Shell Programming and Scripting 4 06-26-2008 12:03 PM
how to retreive a block of data from the file aoussenko Shell Programming and Scripting 2 06-26-2008 08:18 AM
Deleting text block in file andre123 Shell Programming and Scripting 1 02-27-2007 01:17 PM
Select last block from a file misenkiser Shell Programming and Scripting 9 10-11-2006 10:32 AM
extract block in file sskb UNIX for Dummies Questions & Answers 5 10-25-2001 11:29 AM

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 08-20-2008
ROOZ ROOZ is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 48
Adding a block to the file

Hi guys,
I am trying to add the content of fileB into fileA but after a specific block within FileA
for instance i have a file that starts as follow:

-------------------------------------------------------------------------------
-- Title :
-- Project :
-------------------------------------------------------------------------------
-- File :
-- Author :
-- Company :
-- Created :
-- Last update: 2458/05/14
-- Platform :
-------------------------------------------------------------------------------
-- Description: <cursor>
-------------------------------------------------------------------------------
-- Copyright (c)
-------------------------------------------------------------------------------
-- Date Version Author Description
-- 2098-10-17 1.0 Created
-- 2076-12-11 1.0 Imported from
-- 2747-05-03
--------------------------------------------------------------------------

------------------------------------------------------------------------
--
-- Portions Copyright (c)
-- All rights reserved
--
-- Proprietary and Confidential
--
-- Portions of this code embody materials and concepts which are confidential
-- to and is made available
-- solely pursuant to the terms of a written agreement with
-- .
--
--------------------------------------------------------------------------


...the rest of the code

I need to remove the bold part and add content of fileb under the tilted part.
i am pretty much helpless on this part.
I was wondering if someone could help me with this?

Thanks,
  #2 (permalink)  
Old 08-20-2008
redoubtable redoubtable is offline
Registered User
  
 

Join Date: Aug 2008
Location: Portugal
Posts: 242

Code:
head -n 22 fileA >newfile
cat fileB >>newfile
tail -n 13 fileA >>newfile
mv newfile fileA

This is a very simple solution if fileA is exactly has you posted. Since you didn't request any pattern matching I figured this is an isolated case.
  #3 (permalink)  
Old 08-20-2008
ROOZ ROOZ is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 48
the problem is that the tilted part could be longer and there are a lot of cases which i could not consider one by one.
secondly there are some code after the bold block and i don't know the exact number of line for each file and then i need to have the exact position where bold block starts(according to ur suggestion)
i apologize for posting such a wage question but this is what i am dealing right now
one more thing, bold block need to be removed. sorry if it is not clear in my previous post; but it seems like u misunderstood my question.
anyhow, I appreciate your help
  #4 (permalink)  
Old 08-20-2008
redoubtable redoubtable is offline
Registered User
  
 

Join Date: Aug 2008
Location: Portugal
Posts: 242
Well, is there any criteria/pattern on the files? If they have dynamic length and no specific pattern I'm afraid it's impossible.
  #5 (permalink)  
Old 08-20-2008
ROOZ ROOZ is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 48
I just posted another question which is related to this problem, lets say i just focus on removing the bold portion. what could i do about that
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 02:21 PM.


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