Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to catch text in text file using shell script

Posted on 2008-06-11
2
Medium Priority
?
472 Views
Last Modified: 2013-12-26
Hi,
I want to update a file that is stored in ClearCase but I only want to update the file if there is
something to update. To check this I use diff and send the result to a text file. When there are no
differences the text file contains the string "Files are identical".
My problem is that I don't know how to get that string and use it as you can see below.

cleartool setview -exec 'cleartool diff <file1> <file2> > <difflog.txt>' <ClearCase wiew>
if result in difflog.txt neq "Files are identical" ; then
      check out file2
      copy file1 to file2
      check in file2
fi
0
Comment
Question by:eberper
2 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 1000 total points
ID: 21757760
Hello eberper,

filecontents=`cat filename`

if [ "$filecontents" != "FIles are identical" ]
then
   ...
fi

Regards,
sunnycoder
0
 

Author Closing Comment

by:eberper
ID: 31466049
Thank you for a fast answer and simpel solution.

BR
Berndt
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month9 days, 8 hours left to enroll

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question