comparing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting comparing
# 1  
Old 02-19-2009
comparing

i have a file which has following content:

the value of x is : 5

In another file i have:

the value of x is :

i want when i will compare both file then output should come like

the value of x is : 5

need some help
# 2  
Old 02-19-2009
CPU & Memory

file1
x=5
file2
y=5

if [ $y == "" ]
then
echo $x
else
echo "$y Not null"
fi

is this what you needed?

Thanks
Sha
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing two tables

I have defined a set of global variables at the beginning of my script as below: #ideal values export ITEM1=SUCCESS export ITEM2=FAILURE export ITEM3=UNAVAILABLE export ITEM5=FAILURE export ITEM6=SUCCESS now I have a shell script function which returns a value in below format. ITEM1... (1 Reply)
Discussion started by: ctrld
1 Replies

2. Homework & Coursework Questions

Comparing Files

Hello all. Quick question. I have to compare these 2 files and display the lines of one file that match a column in another file. So I have 2 files both contain 3 fields. I want to compare the first field from the first file to the second file. If there is a match I want to display the... (5 Replies)
Discussion started by: Introuble99
5 Replies

3. UNIX for Dummies Questions & Answers

Comparing rows

Hi, I have txt file below 02.05.2014,10.05.2014,dfs,srtytr,tyhty 05.10.2014,15.10.2014,456ef,t6y5fgtd,xg45t 21.11.2014,28.11.2014,sefser,dfw344,zsdfrw 22.12.2014,30.12.2014,fwe,aerw4,zwq4q my script will ask two input, enter start date 05.10.2014 enter end date... (3 Replies)
Discussion started by: stew
3 Replies

4. Shell Programming and Scripting

Help comparing files

Hi Everybody, I have an requirement in my project like I need to compare first 2 columns of two files and create a 3rd file in the format col1 col2 Y/N(Indicating matched or not) Ex: File 1: Col1 Col2 Col3 col 4 File 2: col1 col2 col5 col6 File 3: col1 col2 Y col3 col4 N col5 col6 N... (1 Reply)
Discussion started by: mr_manii
1 Replies

5. Shell Programming and Scripting

comparing with numbers.

How to compare a variable with a value like 00:00:10 ? Thanks (4 Replies)
Discussion started by: nagendramv
4 Replies

6. Shell Programming and Scripting

Comparing files

Hi All, I want to compare two files which looks like this File1: - 5 A 4 B 3 C 2 D File2: - 9 C 7 A 5 D 4 B Now these files are tobe compared in a way that we will select 5 from the first file it is corresponding 2nd column is A, it should be compared with the... (5 Replies)
Discussion started by: balu_puttaganti
5 Replies

7. Shell Programming and Scripting

Comparing two files

Hi, I have two files in this format. The files contain the statistics of tables as seen below. The other file is also in this format. I need to compare both the files and if there is a mismatch i need to display the contents within the break lines from both the files for that corresponding... (32 Replies)
Discussion started by: ragavhere
32 Replies

8. Shell Programming and Scripting

Comparing two files

Hi I have two files X and Y. I have to compare two files and dispaly the lines which are present in X and not in Y along with the line numbers ex X Y a a b b c g e output Z 3. c Thanks (2 Replies)
Discussion started by: superstar003
2 Replies

9. Forum Support Area for Unregistered Users & Account Problems

Comparing two files

Hi I have two files X and Y. I need to compare both the files and need to get the columns whicha re found in X and not in Y along with the line numbers eg X Y a a b b c e d d Thanks (1 Reply)
Discussion started by: superstar003
1 Replies

10. Shell Programming and Scripting

comparing strings

i have a string in a file which gets repeated number of times like below: rpttxt("abc") . . rpttxt("REP_TITLE") rpttxt("BOS_TITLE") . . . . and so on using awk or grep how can i comapre the string( as the second half keeps varying) and store it in a temporary variable? I am using the... (3 Replies)
Discussion started by: agarwal
3 Replies
Login or Register to Ask a Question