Sponsored Content
Top Forums UNIX for Dummies Questions & Answers compare two files if doesnt match then display error message Post 302293476 by Yogesh Sawant on Tuesday 3rd of March 2009 06:44:08 AM
Old 03-03-2009
execute: grep '75%' filename >/dev/null and based on the exit status in $? (either 0 or 1), echo matched or not matched
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk Array doesnt match for substring

Awk Array doesnt match for substring nawk -F"," 'FNR==NR{a=$2 OFS $3;next} a{print $1,$2,a}' OFS="," file1 file2 I want cluster3 in file1 to match with cluster3int in file2 output getting: Output required: Help is appreciated (8 Replies)
Discussion started by: pinnacle
8 Replies

2. Shell Programming and Scripting

Email alert doesnt contain any message

I have created a script which will monitor disk space in unix, it will send an email alert that will notify the specified receipients. I used echo in the mailx command but the email doesnt contain any message. I have used printf to store the message ($message2) and when tried to display on the... (2 Replies)
Discussion started by: lscanaleta
2 Replies

3. UNIX for Dummies Questions & Answers

mawk script to compare 2 files and report where they match

I have two files and would like a report of where they match. Example of file1: 1 1 1 2 2 2 13 14 15 4 4 4 15 16 17 100 102 1004 56 57 890 Example of file2: 2 2 2 16 10 11 45 22 35 13 14 15 1001 1002 3456 100 102 1004 (1 Reply)
Discussion started by: kenneth.mcbride
1 Replies

4. UNIX for Dummies Questions & Answers

IPC Message Queue. msgrcv doesnt work..

Hi everybody, this is the situation. there is a programm XYZ which opens a message queue with the key 47110815 and waits for a SIGUSR1. After receiving this signal it sends a message with type 100 and a number (as ASCII) in the message-body. I have to write a prog which frist sends the... (1 Reply)
Discussion started by: daredevil82m
1 Replies

5. Shell Programming and Scripting

Match strings in two files and compare columns of both

Good Morning, I was wondering if anybody could tell me how to achieve the following, preferably with a little commenting for understanding. I have 2 files, each with multiple rows with multiple columns. I need to find each row where the value in column 1 of file 1 matches column 1... (10 Replies)
Discussion started by: GarciasMuffin
10 Replies

6. Shell Programming and Scripting

Shell script compare all parameters in two files and display results

Hi , I am not familiar with shell programming. I have a requirement like i have two files .I need to compare the two files by comparing each parameter and i should produce 2 outputs. 1)i have around 35 parameters say i have one parameter name called db_name=dcap in one file and... (7 Replies)
Discussion started by: muraliinfy04
7 Replies

7. Shell Programming and Scripting

How to use awk shell script to compare and match two files?

Basically, I have two files dupestest.txt 152,153 192,193,194 215,216 290,291 2279,2280 2282,2283haftest.txt 152,ABBOTS ROAD 153,ABBOTS ROAD 154,ABBOTS ROAD 155,ABBOTS ROAD 156,ABBOTS ROAD 157,ABBOTS ROADI want to find the numbers in dupestest.txt in haftest.txt... (4 Replies)
Discussion started by: amyc92
4 Replies

8. UNIX for Dummies Questions & Answers

[Solved] Grep multiple files and display first match

I have a need to grep a large number of files, but only display the first result from each file. I have tried to use grep, but am not limited to it. I can use perl and awk as well. Please help! (9 Replies)
Discussion started by: dbiggied
9 Replies

9. Shell Programming and Scripting

Compare two files and find match and print the header of the second file

Hi, I have two input files; file1 and file2. I compare them based on matched values in 1 column and print selected columns of the second file (file2). I got the result but the header was not printed. i want the header of file2 to be printed together with the result. Then i did below codes:- ... (3 Replies)
Discussion started by: redse171
3 Replies

10. UNIX for Beginners Questions & Answers

Count the number of files to delete doesnt match

Good evening, need your help please Need to delete certain files before octobre 1 2016, so need to know how many files im going to delete, for instance ls -lrt file_20160*.lis!wc -l but using grep -c to another file called bplist which contains the list of all files backed up doesn match... (7 Replies)
Discussion started by: alexcol
7 Replies
GREP(1) 						      General Commands Manual							   GREP(1)

NAME
grep - search a file for lines containing a given pattern SYNOPSIS
grep [-elnsv] pattern [file] ... OPTIONS
-e -e pattern is the same as pattern -c Print a count of lines matched -i Ignore case -l Print file names, no lines -n Print line numbers -s Status only, no printed output -v Select lines that do not match EXAMPLES
grep mouse file # Find lines in file containing mouse grep [0-9] file # Print lines containing a digit DESCRIPTION
Grep searches one or more files (by default, stdin) and selects out all the lines that match the pattern. All the regular expressions accepted by ed and mined are allowed. In addition, + can be used instead of * to mean 1 or more occurrences, ? can be used to mean 0 or 1 occurrences, and | can be used between two regular expressions to mean either one of them. Parentheses can be used for grouping. If a match is found, exit status 0 is returned. If no match is found, exit status 1 is returned. If an error is detected, exit status 2 is returned. SEE ALSO
cgrep(1), fgrep(1), sed(1), awk(9). GREP(1)
All times are GMT -4. The time now is 02:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy