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
select a portion of a file into a CSV anju Shell Programming and Scripting 8 02-27-2008 09:50 PM
Delete Portion of a file sameersbn High Level Programming 2 01-19-2007 08:16 PM
extract date portion from file misenkiser Shell Programming and Scripting 5 10-06-2006 02:37 AM
extract a portion of log file chandra004 Shell Programming and Scripting 8 08-03-2006 05:20 PM
remove portion of file methos Shell Programming and Scripting 13 08-16-2002 06:26 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-07-2008
Registered User
 

Join Date: Dec 2007
Location: Gotham City
Posts: 55
Help needed in changing contents of portion of the file

Hi all,

I need help on this.

I have a file with 4500 bytes. I want to modify the contents of line from 1357 through 3208.

1. Starting 1357, there is 35 occurence of 40 bytes data making it to 2757.

2. The remaining 451 filler with spaces taking it to 3208.

Now, the 40 byte data is changing to 43 bytes. Hence the filler reduces to 347.

I want to add 3 spaces on the 5th position of that 40 byte data (in all 35 occurences). So my contents will start from 1357 and end in 2862 and then append 347 spaces till 3208

I have attached a sample record in tmp.txt to avoid confusion.

Any help is highly appreciated
JAK
Attached Files
File Type: txt tmp.txt (4.4 KB, 0 views)
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-07-2008
Registered User
 

Join Date: Dec 2007
Location: Gotham City
Posts: 55
Clarification -- files with multiple records and each record size is 4500 bytes.

Thanks!
Reply With Quote
  #3 (permalink)  
Old 07-08-2008
Registered User
 

Join Date: Dec 2007
Location: Gotham City
Posts: 55
Solved it .. thx !
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:34 PM.


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 Global Fact Book

Content Relevant URLs by vBSEO 3.2.0