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
editing ELF file tejuwala Linux 1 05-17-2008 08:22 PM
Editing file rahul303 Shell Programming and Scripting 4 09-23-2007 07:49 PM
Editing File using awk/sed Mohammed Shell Programming and Scripting 4 05-16-2007 08:00 AM
Editing the File using Awk awk_beginner Shell Programming and Scripting 3 04-06-2007 07:43 AM
File editing using awk rinku11 Shell Programming and Scripting 2 11-23-2006 08:34 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-31-2007
Registered User
 

Join Date: Jul 2006
Posts: 183
Help with editing file

I have a file of 100000 records. This file is created by concatenation of two files. I want to edit this file from record number 80,000 till the end and add "|N" for each record . How can I acheive this. Please suggest
Reply With Quote
Forum Sponsor
  #2  
Old 01-31-2007
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Use this command in vi
Code:
80000,$ s/$/|N/
Reply With Quote
  #3  
Old 01-31-2007
Registered User
 

Join Date: Jul 2006
Posts: 183
If the file is too large I am getting error as temp file too large. In this case what should I do?
Reply With Quote
  #4  
Old 01-31-2007
aigles's Avatar
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,212
find a filesystem with free space (/fs for example) to use for temp file and modify the file with sed:
Code:
sed '80000,$ s/$/|N/' infile > /fs/temp
mv /fs/temp outfile
Jean-Pierre.
Reply With Quote
  #5  
Old 01-31-2007
aigles's Avatar
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,212
Another solution :
Code:
sed ''80000,$ s/$/|N/' inputfile1 inputfile2 > resultfile
Jean-Pierre.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 02:26 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