Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

delete the lines from file

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 04-01-2006
sameersam sameersam is offline
Registered User
 
Join Date: Apr 2006
Last Activity: 17 December 2007, 7:55 AM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
delete the lines from file

i have two files & want to delete the lines from 2nd file which matches with 1st file
Sponsored Links
    #2  
Old Unix and Linux 04-01-2006
blowtorch's Unix or Linux Image
blowtorch blowtorch is offline Forum Advisor  
AFK
 
Join Date: Dec 2004
Last Activity: 1 July 2016, 6:18 AM EDT
Location: UK
Posts: 2,351
Thanks: 0
Thanked 6 Times in 6 Posts
Try using the comm command. Check the man page for details on which switch to use.
Sponsored Links
    #3  
Old Unix and Linux 04-04-2006
npn npn is offline
Registered User
 
Join Date: Dec 2005
Last Activity: 3 February 2009, 7:43 AM EST
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb deleting Lines

You can do a diff and then write these records into a new file and delete file2.
then rename it to file2. U need some minor tweaking for this to work.

However, for this the File 1 must be a Master file. It should always contain all the records which could be present in the file2.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
In a huge file, Delete duplicate lines leaving unique lines krishnix UNIX for Advanced & Expert Users 16 08-04-2011 04:47 AM
Delete some lines in a file ponmuthu UNIX for Advanced & Expert Users 5 07-28-2010 02:39 PM
How get only required lines & delete the rest of the lines in file reva UNIX for Dummies Questions & Answers 7 06-01-2010 02:58 AM
How to delete lines in a file that have duplicates or derive the lines that aper once necroman08 Shell Programming and Scripting 3 07-17-2009 05:07 AM
delete first 100 lines from a file salaathi Solaris 7 06-09-2009 10:10 PM



All times are GMT -4. The time now is 11:50 PM.