Sponsored Content
Top Forums Shell Programming and Scripting Check if 2 input values exists in a file Post 302957653 by aneeta13 on Tuesday 13th of October 2015 05:44:39 PM
Old 10-13-2015
Check if 2 input values exists in a file

I have a file number.txt.I need to get 2 inputs from the terminal like a=100 and b=200.If a and b are there in the file,then check if a < b,print "less".If a is not there in the file,print "a is missing" or if b is not there in the file,print "b is missing".

number.txt:
Code:
100 200 300


Last edited by Don Cragun; 10-13-2015 at 11:16 PM.. Reason: Add CODE and ICODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to check if file exists

guys, I am trying to write a script that does the following: it looks for a file in a specific directory and if the file is not there (NOT), it emails me. I have tried the following but its not working. It simply hangs up. Please help. if then mail -s 'blah blah blah' my email... (4 Replies)
Discussion started by: basisvasis
4 Replies

2. Shell Programming and Scripting

Check to see if a file exists?

Hi. I'd like to have an IF-Then-Else statement where I can check to see if a file exists? We have the Bourne Shell by default. I'm looking for the syntax to do something like this: if myfile.txt exists then ...my code else ...my code end if Any help would be greatly... (5 Replies)
Discussion started by: buechler66
5 Replies

3. Shell Programming and Scripting

Script to check file exists

Hi, I am trying to write a script which checks if any file exists with "*.log" or "*.out" in Directory below is the code #------------------ path=/abd/xyz/ if ; then echo "Good" else echo "Failure" fi #-------------------------- its always going to else part and printing... (8 Replies)
Discussion started by: ch33ry
8 Replies

4. Shell Programming and Scripting

how to check to see if a file exists?

I want to write a script to see if various files exist. What I want to do is have the script search in various directories if a file exist, and if not, then output something like "/path/file does not exist". I don't actually know of how to check and see if a file exists or not. What I have in mind... (2 Replies)
Discussion started by: astropi
2 Replies

5. Shell Programming and Scripting

How to check if a file exists in a directory?

I want to perform SQL *Loader operation only if a file named "load.txt" exists in a directory "/home/loc/etc". Please help how to check this with a if condition. (8 Replies)
Discussion started by: vel4ever
8 Replies

6. Shell Programming and Scripting

File exists, but cannot be opened.How to check- whether it could be opened to read when it exists

Hi #Testing for file existence if ; then echo 'SCHOOL data is available for processing' else echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING' : i wrote a script, where it begins by checking if file exists or not. If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies

7. Shell Programming and Scripting

Check if file exists or not

Hi, I want to check if the file exists or not in the directory. i am trying below code but not working. File="/home/va59657/Account_20090213*.dat" echo "$File" if ]; then echo "file found" else echo "file not found" fi However i am getting file not found even if file exits as... (5 Replies)
Discussion started by: Vivekit82
5 Replies

8. Shell Programming and Scripting

Check if a string exists in a file

bash in RHEL 6.3 I have these 2 files with strings. $ cat someStrings.txt LOGICAL1 HUNGARY2 PENGUIN2 MOBILE GUITAR1 MOUSE1 $$ cat checkIF.txt PENGUIN MOBILE $I need to search for strings in someStrings.txt file that matches the patterns in checkIF.txt file. The strings in... (7 Replies)
Discussion started by: kraljic
7 Replies

9. Shell Programming and Scripting

To check if file exists

Hi, I have the below code written. However I am not getting the desired output I am checking if the particular path has file in it. #!/bin/bash ls -l /IRS2/IRS2_ODI/INFILE/*LS* 1>/dev/null 2>/dev/null if then echo $? echo "File Exists" fi ... (3 Replies)
Discussion started by: Shanmugapriya D
3 Replies

10. UNIX for Beginners Questions & Answers

Check if file exists

I need to check whether a file exists and has been changed. The file should contain a specific string. The file should also have been changed within the last ten seconds. How do I do that? (3 Replies)
Discussion started by: locoroco
3 Replies
Test::Image::GD(3pm)					User Contributed Perl Documentation				      Test::Image::GD(3pm)

NAME
Test::Image::GD - A module for testing images using GD SYNOPSIS
use Test::More plan => 1; use Test::Image::GD; cmp_image('test.gif', 'control.gif', '... these images should match'); # or my $test = GD::Image->new('test.gif'); my $control = GD::Image->new('control.gif'); cmp_image($test, $control, '... these images should match'); # some other test functions ... size_ok('camel.gif', [ 100, 350 ], '... the image is 100 x 350"); height_ok('test.gif', 200, '... the image has a height of 200'); width_ok('test.gif', 200, '... the image has a width of 200'); DESCRIPTION
This module is meant to be used for testing custom graphics, it attempts to "visually" compare the images, this means it ignores invisible differences like color palettes and metadata. It also provides some extra functions to check the size of the image. FUNCTIONS
cmp_image ($got, $expected, $message) This function will tell you whether the two images will look different, ignoring differences in the order of colors in the color palette and other invisible changes. Both $got and $expected can be either instances of "GD::Image" or either a file handle or a file path (both are valid parameters to the "GD::Image" constructor). size_ok ($got, [ $width, $height ], ?$message) This function will check if an image is a certain size. As with the "cmp_image" function, the $got parameter can be either an instance of "GD::Image" or a file handle or a file path (all are valid parameters to the "GD::Image" constructor). height_ok ($got, $height, ?$message) This function will check if an image is a certain height. As with the "cmp_image" function, the $got parameter can be either an instance of "GD::Image" or a file handle or a file path (all are valid parameters to the "GD::Image" constructor). width_ok ($got, $width, ?$message) This function will check if an image is a certain width. As with the "cmp_image" function, the $got parameter can be either an instance of "GD::Image" or a file handle or a file path (all are valid parameters to the "GD::Image" constructor). TO DO
Add more functions This module currently serves a very basic need of mine, however, I am sure as I start writing more tests against images I will find a need for other testing functions. Any suggestions are welcome. BUGS
None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it. CODE COVERAGE
I use Devel::Cover to test the code coverage of my tests, below is the Devel::Cover report on this module test suite. ---------------------------- ------ ------ ------ ------ ------ ------ ------ File stmt bran cond sub pod time total ---------------------------- ------ ------ ------ ------ ------ ------ ------ Test/Image/GD.pm 100.0 91.7 63.6 100.0 100.0 100.0 93.7 ---------------------------- ------ ------ ------ ------ ------ ------ ------ Total 100.0 91.7 63.6 100.0 100.0 100.0 93.7 ---------------------------- ------ ------ ------ ------ ------ ------ ------ SEE ALSO
The "compare" function of "GD::Image" class, that is how this "cmp_image" is implemented. AUTHOR
Stevan Little, <stevan@iinteractive.com> COPYRIGHT AND LICENSE
Copyright 2005 by Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2005-12-09 Test::Image::GD(3pm)
All times are GMT -4. The time now is 11:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy