how to grep a file based on another input file
File1
ashu 1 ninetwo hari
qwer 6 givefour jan
fghj 8 noeight mar
vbmi 7 noput feb
--
---
File2
noput
noeight
---
--
Taking the input of grep as File2, a search need to be made in File1 giving File3 as output: (7 Replies)
Give shell script....which takes two file names as input and compares the contents, is both are same delete second file's contents.....
I try with "diff"...... but confusion how to use "diff" with if ---else
Thanking you (5 Replies)
does any one know how to turn the equivalent of this command:
awk '/2011 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
to
something that would use egrep instead of awk?
What the awk command does is, it searches the ops.log file for "2011 John Doe 8344". When it finds it,... (4 Replies)
I have a list of fields that I want to check a file for, returning that field if it not found at all in the file. Is there a way to do a grep -lc and return the passed variable too rather then just the count?
I am doing some crappy work-around now but I was not sure how to regrep this for :0 so... (3 Replies)
Hi,
I want to delete the contents of a file which are matching with contents of other file in shell scripting.
Ex.
file1
sheel,sumit,1,2,3,4,5,6,7,8
sumit,rana,2,3,4,5,6,7,8,9
grade,pass,2,3,4,5,6,232,1,1
name,sur,33,1,4,12,3,5,6,8
sheel,pass,2,3,4,5,6,232,1,1
File2... (3 Replies)
Hi,
I am facing issue while reading data from a file in UNIX. my requirement is to compare two files and for the text pattern matching in the 1st file, replace the contents in second file by the contents of first file from start to the end and write the contents to thrid file.
i am able to... (2 Replies)
Hi All,
I need to recursively grep several folders for a MAC address and display the results with the date of the file name at the start. Even better would be if the final results were displayed chronologically so the newest file is always at the end. Oldest at the top, regardless of what... (8 Replies)
Hi one of the output of the command is as below
# sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/'
Resource List : <br>
*************************** 1. row ***************************<br>
... (2 Replies)
Shell script logic
Hi
I have 2 input files like with file 1 content as (file1)
"BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt
File 2 contents as fle(2)
"BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt
I want to get... (22 Replies)
So I'm stumped.
First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes.
I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies
LEARN ABOUT DEBIAN
ace::browser::searchsubs
Ace::Browser::SearchSubs(3pm) User Contributed Perl Documentation Ace::Browser::SearchSubs(3pm)NAME
Ace::Browser::SearchSubs - Subroutines for AceBrowser search scripts
SYNOPSIS
use Ace;
use Ace::Browser::AceSubs;
use Ace::Browser::SearchSubs;
use CGI qw(:standard);
my $form = p(start_form,
textfield(-name=>'query'),
end_form);
AceSearchTable('Search for stuff',$form);
...
my $query = param('query');
my $offset = AceSearchOffset;
my ($objects,$count) = do_search($query,$offset);
AceResultsTable($objects,$count,$offset,'Here are results');
DESCRIPTION
Ace::Browser::SearchSubs exports a set of constants and subroutines that are useful for creating AceBrowser search scripts.
CONSTANTS
This package exports the following constants:
MAXOBJECTS The maximum number of objects that can be displayed
per page.
SEARCH_ICON An icon to use for search links. This is deprecated.
Use Configuration->Search_icon instead.
FUNCTIONS
These functions are exported:
$offset = AceSearchOffset()
When the user is paging back and forth among a multi-page list of results, this function returns the index of the first item to
display.
AceSearchTable([{hash}],$title,@contents)
Given a title and the HTML contents, this formats the search into a table and gives it the background and foreground colors used
elsewhere for searches. The formatted search is then printed.
The HTML contents are usually a fill-out form. For convenience, you can provide the contents in multiple parts (lines or elements) and
they will be concatenated together.
If the first argument is a hashref, then its contents will be passed to start_form() to override the form arguments.
AceResultsTable($objects,$count,$offset,$title)
This subroutine formats the results of a search into a pageable list and prints out the resulting HTML. The following arguments are
required:
$objects An array reference containing the objects to place in the
table.
$count The total number of objects.
$offset The offset into the array, as returned by AceSearchOffset()
$title A title for the table.
The array reference should contain no more than MAXOBJECTS objects. The AceDB query should be arranged in such a way that this is the
case. A typical idiom is the following:
my $offset = AceSearchOffset();
my $query = param('query');
my $count;
my @objs = $db->fetch(-query=> $query,
-count => MAXOBJECTS,
-offset => $offset,
-total => $count
);
AceResultsTable(@objs,$count,$offset,'Here are the results');
BUGS
Please report them.
SEE ALSO
Ace::Object, Ace::Browser::SiteDefs, Ace::Browsr::AceSubs, the README.ACEBROWSER file.
AUTHOR
Lincoln Stein <lstein@cshl.org>.
Copyright (c) 2001 Cold Spring Harbor Laboratory
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for
disclaimers of warranty.
perl v5.14.2 2006-11-01 Ace::Browser::SearchSubs(3pm)