The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Rename file based on first 3 characters of data in file jchappel UNIX for Dummies Questions & Answers 3 10-01-2008 02:21 PM
Extracting data from text file based on configuration set in config file suparnbector Shell Programming and Scripting 3 08-10-2007 02:25 AM
how to delete record in file data with index in another file? zhynxn Shell Programming and Scripting 0 07-06-2006 12:03 AM
i want to delete a file based on existing file in a directory srivsn Shell Programming and Scripting 3 04-11-2006 04:38 AM
Append a field to the end of each line of a file based on searching another file. ultimate Shell Programming and Scripting 2 03-29-2005 10:21 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-29-2008
earth_goddess earth_goddess is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 1
Question Delete line in file based on data in another file

Hi there

I would like to create a shell script to do the following:
- delete a line in file1 if it contains the data string in file2
eg: file1
1 100109942004051510601703694 0.00 0.00
2 100109942004051510601702326 0.00 0.00
3 100109942004051510601702327 0.00 0.00
file2
1 3694
2 3741
3 3834
In the above example line1 of file1 must be deleted because it contains the string of line1 in file2 "3694".
Also, the data sting must be in position 24 in each line
100109942004051510601703694 0.00 0.00
for it to be deleted.
Hope this is sufficient information for a possible solution.
I never did any shell scripting before so the help would very much be appreciated.
Thanks
  #2 (permalink)  
Old 12-29-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
Use grep, check the the -v and -f option in the manpage.

Regards
Sponsored Links
Closed Thread

Bookmarks

Tags
sed delete line

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 03:24 AM.


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