Sponsored Content
Top Forums Shell Programming and Scripting Substraction of matching lines from a file. Post 302847373 by krishmaths on Tuesday 27th of August 2013 12:22:48 AM
Old 08-27-2013
You can probably do this if it is okay to create another file and then move it to original file

Code:
grep -vf file2 file1 >file3
mv file3 file1

This User Gave Thanks to krishmaths For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading lines in a file matching a pattern

Hi, I need to redirect the lines in a file to a different file if the character starting from 2 to 6 in the line are numerical . Please let me know if anyone have any script to do this. Thanks, Ranjit (4 Replies)
Discussion started by: torenji
4 Replies

2. Shell Programming and Scripting

delete lines in file matching a pattern

I have a text file, a sample of which is as follows: r/- * 0: WINDOWS/Microsoft.NET/Framework/v2.0.50727/ASP.NETWebAdminFiles/Images/headerGRADIENT_Tall.gif r/- * 0: WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/backoff.jpg r/- * 0: ... (2 Replies)
Discussion started by: stumpyuk
2 Replies

3. Shell Programming and Scripting

How to print file without few exactly matching lines?

Hi I have a very long file with 4 columns of numbers for example 1875 1876 12725 12723 13785 13786 4232 4230 13184 13185 ... (2 Replies)
Discussion started by: ananyob
2 Replies

4. Shell Programming and Scripting

Print lines matching value(s) in other file using awk

Hi, I have two comma separated files. I would like to see field 1 value of File1 exact match in field 2 of File2. If the value matches, then it should print matched lines from File2. I have achieved the results using cut, paste and egrep -f but I would like to use awk as it is efficient way and... (7 Replies)
Discussion started by: SBC
7 Replies

5. Shell Programming and Scripting

Finding lines matching the Pattern and their previous lines in a file

Hi, I am trying to locate the occurences of certain pattern like 'Possible network disconnect' in a text file. I can get the actual lines matching the pttern using: grep -w 'Possible network disconnect' file_name. But I am more interested in getting the timing of these events which are... (7 Replies)
Discussion started by: sagarparadkar
7 Replies

6. Shell Programming and Scripting

Print matching lines in a file

Hello everyone, I have a little script below: die "Usage infile outfile reGex" if @ARGV != 3; ($regex) = @ARGV; open(F,$ARGV) or die "Can't open"; open(FOUT,"+>$ARGV") or die "Can't open"; while (<F>) { print FOUT if /$regex/.../$regex/; } No matter what I give $regex on the... (2 Replies)
Discussion started by: new bie
2 Replies

7. Shell Programming and Scripting

Compare file1 for matching line in file2 and print the difference in matching lines

Hello, I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies

8. Shell Programming and Scripting

awk to combine matching lines in file

I am trying to combine all matching lines in the tab-delimited using awk. The below runs but no output results. Thank you :). input chrX 110925349 110925532 ALG13 chrX 110925349 110925532 ALG13 chrX 110925349 110925532 ALG13 chrX 47433390 47433999 SYN1... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. UNIX for Beginners Questions & Answers

awk to average matching lines in file

The awk below executes and is close (producing the first 4 columns in desired). However, when I add the sum of $7, I get nothing returned. Basically, I am trying to combine all the matching $4 in f1 and output them with the average of $7 in each match. Thank you :). f1 ... (2 Replies)
Discussion started by: cmccabe
2 Replies
Color::Library(3pm)					User Contributed Perl Documentation				       Color::Library(3pm)

NAME
Color::Library - An easy-to-use and comprehensive named-color library VERSION
version 0.021 SYNOPSIS
use Color::Library; # Search for a sea blue color my $seablue = Color::Library->color("seablue"); # Search for a grey73 in the 'svg' and 'x11' dictionaries only my $grey73 = Color::Library->colour([qw/svg x11/] => "grey73"); # Find a bunch of colors at the same time my ($red, $green, $blue) = Color::Library->colors(qw/red green blue/); # Fetch the named color "aliceblue" from the SVG dictionary my $color = Color::Library->SVG->color("aliceblue"); # Prints out "aliceblue is #ff08ff" print $color->name, "is ", $color, " "; # Get a list of names in the svg dictionary my @names = Color::Library->SVG->names; # Get a list of colors in the x11 dictionary my @colors = Color::Library->dictionary('x11')->colors; DESCRIPTION
Color::Library is an easy-to-use and comprehensive named-color dictionary. Currently provides coverage for www (svg, html, css) colors, x11 colors, and more. DICTIONARIES
The following dictionaries are available in this distribution: Color::Library::Dictionary::SVG - Colors from the SVG specification Color::Library::Dictionary::X11 - Colors for the X11 Window System (rgb.txt) Color::Library::Dictionary::HTML - Colors from the HTML 4.0 specification Color::Library::Dictionary::IE - Colors recognized by Internet Explorer Color::Library::Dictionary::Mozilla - Colors recognized by Mozilla (ColorNames.txt) Color::Library::Dictionary::Netscape - Colors recognized by Netscape Color::Library::Dictionary::Windows - Colors from the Windows system palette Color::Library::Dictionary::VACCC - VisiBone Anglo-Centric Color Code Color::Library::Dictionary::NBS_ISCC - Centroids of the NBS/ISCC catalog Color::Library::Dictionary::NBS_ISCC::A - Dye Colors Color::Library::Dictionary::NBS_ISCC::B - Colour Terminology in Biology Color::Library::Dictionary::NBS_ISCC::F - Colors; (for) Ready-Mixed Paints Color::Library::Dictionary::NBS_ISCC::H - Horticultural Colour Charts Color::Library::Dictionary::NBS_ISCC::M - Dictionary of Color Color::Library::Dictionary::NBS_ISCC::P - Plochere Color System Color::Library::Dictionary::NBS_ISCC::R - Color Standards and Color Nomenclature Color::Library::Dictionary::NBS_ISCC::RC - Rock-Color Chart Color::Library::Dictionary::NBS_ISCC::S - Postage-Stamp Color Names Color::Library::Dictionary::NBS_ISCC::SC - Soil Color Charts Color::Library::Dictionary::NBS_ISCC::TC - Standard Color Card of America You can see a list of colors in any of these by reading their perldoc. For example: perldoc Color::Library::Dictionary::VACCC If you have any suggestions for more color dictionaries to integrate, contact me. METHODS
$dictionary = Color::Library->dictionary( <dictionary_id> ) Returns a Color::Library::Dictionary object corresponding to <dictionary_id> @dictionaries = Color::Library->dictionaries @dictionaries = Color::Library->dictionaries( <dictionary_id>, <dictionary_id>, ... ) $dictionaries = Color::Library->dictionaries( <dictionary_id>, <dictionary_id>, ... ) In list context, returns a list of Color::Library::Dictionary objects (for each <dictionary_id> passed in In scalar context, returns a hash of Color::Library::Dictionary objects mapping a dictionary id to a dictionary When called without arguments, the method will return all dictionaries $color = Color::Library->color( <query> ) Returns a Color::Library::Color object found via <query> A query can be any of the following: color name A color name is like "blue" or "bleached-almond" color title A color title is like "Dark Green-Teal" color id A color id is in the form of <dictionary_id>:<color_name>, for example: "x11:azure1" color( <query>, <query>, ... ) In list context, returns a list of Color::Library::Color objects corresponding to each <query> In scalar context, just returns the first <query> color( <dictionaries>, <query>, ... ) If an array reference is passed as the first argument, then this indicates that the array is a list of dictionary ids to search through (in order): # Search in the svg and x11 dictionaries for a match my $blue = Color::Library->color([qw/svg x11/], "blue"); # Will not find "aquamarine1" in the svg dictionary, so it will try the x11 dictionary my $aquamarine1 = Color::Library->color([qw/svg x11/], "aquamarine1"); $color = Color::Library->colors $color = Color::Library->colour $color = Color::Library->colours All are aliases for the above color method ABOUT
This package was inspired by Graphics::ColorNames, and covers much of the same ground. However, I found the Graphics::ColorNames interface difficult to use. I also wanted to list colors directly in the perldoc, which this package does. SEE ALSO
Graphics::ColorNames AUTHOR
Robert Krimen <robertkrimen@gmail.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Robert Krimen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2011-12-07 Color::Library(3pm)
All times are GMT -4. The time now is 05:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy