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 07:34 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-31-2007
Registered User
 

Join Date: Jul 2006
Posts: 183
Stumble this Post!
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 (permalink)  
Old 01-31-2007
Registered User
 

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

Join Date: Jul 2006
Posts: 183
Stumble this Post!
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 (permalink)  
Old 01-31-2007
aigles's Avatar
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,211
Stumble this Post!
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 (permalink)  
Old 01-31-2007
aigles's Avatar
Registered User
 

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

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0