473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to grep from multiple files given one of those files dont exist

I am trying to grep for a particular word from two files like below. I need to find the word in one of the two files

grep "myWord" file1 file2 && echo 1 or echo 0

The issue is that I have to search in both the files, but sometimes one of these files doesnt exist. So even when the word is present in one of the files it stil returns a 0.
Nov 2 '12 #1
0 1643

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Matthias Martetschlaeger | last post by:
Hi everyone, we use Clearcase dynamic Views to get our Source-Files. Due speed reasons, the output files should not go to the same location (dynamic view) as the source files are located, this...
14
by: Dixie | last post by:
I am trying to write some code that when I exit my application kills all of the text files in a certain folder. It is possible that some of those files are locked because someone else is using...
3
by: Jackie | last post by:
Hi all, I am new to visual c++, and found that each C++ project automatically generates source files and resource files, what are their roles, respectively? Thanks a lot.
3
by: utab | last post by:
Dear all, What are the advantages of binary files over text files? I would like to search for a specific value of a variable in an output file, I was doing this lately by the string library...
2
by: Craig | last post by:
Hi there, I'm trying to convert some PNG files to bitmap files which can then be converted to X11 bitmaps using the im.tobitmap() function. But the error I get when using the im.tobitmap()...
2
by: asenthil | last post by:
Hai to all.. i'm senthil.... i'm just now started working in the field of VC++... i'm a beginner to this field... Now i'm trying to convert .txt file to xml files...
1
by: snp3210 | last post by:
Can u tell me , how can we run multiple c and header files to execute a program in turbo c, i am getting errors of not findinf header files and related functions defined in header files. In Gcc if i...
5
by: Alice | last post by:
Anyone knows how to convert .CAP files to .TXT files ? because Access doesn't read .CAP files, so in order to import it, i'd have to manually open all the .CAP files and "save as" filename.txt...
0
by: VigneshS | last post by:
Hi, I am a newbie to Globalization and Localisation Concepts. I tried almost all the methods of the Globalization concepts. But i cannot be able to embed a text file within a Resource. ...
0
by: Chris Rebert | last post by:
On Mon, Sep 15, 2008 at 10:30 AM, aditya shukla <adityashukla1983@gmail.comwrote: Unless your Python scripts are essentially just *really basic* shell scripts that happen to be written in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.