10-05-2007
to compare two files and to print the difference
suppose one file
P1168S
P2150L
P85L
Q597R
R1097C
Another file
P2150L
P85L
Q597R
R1097C
R1379C
R1587K
Then output shud be
R1379C
R1587K
thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have to compare two files for any differences, then output the lab and question number for any differences. This is what I currently have:
diff lab2.txt lab2answer.txt > lab2compare.txt
Though the output doesn't have to be sent to a .txt (or any sort of log), I found that easier, at least... (2 Replies)
Discussion started by: Joesgrrrl
2 Replies
2. Shell Programming and Scripting
I have two files like this:
#FILE 1
ABCD 4322 26485
JMTJ 5311 97248
XMPJ 4321 58978
#FILE 2
ABCD 4321 26485
JMTJ 5311 97248
XMPJ 4321 68978
What to do: Compare the two files and find those lines that doesn't match. And have a new file like this:
#FILE 3
"from file 1"
ABCD 4322 26485... (11 Replies)
Discussion started by: kingpeejay
11 Replies
3. Shell Programming and Scripting
I have learned file comparison from my previous post here. Then, it is comparing the whole line. Now, i have a new problem.
I have two files with 3 columns separated with a "|". What i want to do is to compare the second and third column of file 1, and the second and third column of file 2. And... (4 Replies)
Discussion started by: kingpeejay
4 Replies
4. Shell Programming and Scripting
one file
. . importing table employee 119
. . importing table jobs 1
2nd file
. . importing table employee 120
. . importing table jobs 1
and would like... (2 Replies)
Discussion started by: jhonnyrip
2 Replies
5. UNIX for Dummies Questions & Answers
Hi there,
I'm sure this question has been asked many times but I can't find any posts with information.
How can I check the differences between say lines 20 - 200 in file1 and lines 420 - 600 in file2?
Thanks in advance for any help!
js (2 Replies)
Discussion started by: js8765
2 Replies
6. Shell Programming and Scripting
Hi all,
i have 50 files .data should be same in these 50 files , so my task is to find the difference. i need a logic , which finds difference between all files and print in output file with file name where it found that difference .
i tried below logic , but its not giving me what i want.
let... (2 Replies)
Discussion started by: deepakiniimt
2 Replies
7. Shell Programming and Scripting
Hi experts,
I am trying to compare two text files and output the difference to another file.
I'm not strictly looking for differences in text but additional text at the end of one file that isn't in another, so basically comparing the file 2 against file 1 and printing any additional text to... (9 Replies)
Discussion started by: martin0852
9 Replies
8. Shell Programming and Scripting
Hello,
I have two text files, each with a single column,
file 1:
124152970
123899868
123476854
54258288
123117283
file 2:
124152970
123899868
54258288
123117283
122108330 (5 Replies)
Discussion started by: LMHmedchem
5 Replies
9. Shell Programming and Scripting
Hi
PRIM_SEQ=`some sql code`
and output of PRIM_SEQ is like below
120
130
STB_SEQ=`some sql code`
and output of STB_SEQ is like below
115
110
i need to compare this two variables output ( decimal numbers)
1) What I want to do is to compare every number in the PRIM_SEQ with... (8 Replies)
Discussion started by: amar1208
8 Replies
10. UNIX for Beginners Questions & Answers
compare two variables and print the difference
i have two variables
X1=rac1,rac2
Y1=rac2,rac3
output=rac1,rac3
Use code tags to wrap code fragments or data samples. (1 Reply)
Discussion started by: jhonnyrip
1 Replies
LEARN ABOUT OPENSOLARIS
uplevel
uplevel(1T) Tcl Built-In Commands uplevel(1T)
__________________________________________________________________________________________________________________________________________________
NAME
uplevel - Execute a script in a different stack frame
SYNOPSIS
uplevel ?level? arg ?arg ...?
_________________________________________________________________
DESCRIPTION
All of the arg arguments are concatenated as if they had been passed to concat; the result is then evaluated in the variable context indi-
cated by level. Uplevel returns the result of that evaluation.
If level is an integer then it gives a distance (up the procedure calling stack) to move before executing the command. If level consists
of # followed by a number then the number gives an absolute level number. If level is omitted then it defaults to 1. Level cannot be
defaulted if the first command argument starts with a digit or #.
For example, suppose that procedure a was invoked from top-level, and that it called b, and that b called c. Suppose that c invokes the
uplevel command. If level is 1 or #2 or omitted, then the command will be executed in the variable context of b. If level is 2 or #1
then the command will be executed in the variable context of a. If level is 3 or #0 then the command will be executed at top-level (only
global variables will be visible).
The uplevel command causes the invoking procedure to disappear from the procedure calling stack while the command is being executed. In
the above example, suppose c invokes the command
uplevel 1 {set x 43; d}
where d is another Tcl procedure. The set command will modify the variable x in b's context, and d will execute at level 3, as if called
from b. If it in turn executes the command
uplevel {set x 42}
then the set command will modify the same variable x in b's context: the procedure c does not appear to be on the call stack when d is
executing. The command ``info level'' may be used to obtain the level of the current procedure.
Uplevel makes it possible to implement new control constructs as Tcl procedures (for example, uplevel could be used to implement the while
construct as a Tcl procedure).
namespace eval is another way (besides procedure calls) that the Tcl naming context can change. It adds a call frame to the stack to rep-
resent the namespace context. This means each namespace eval command counts as another call level for uplevel and upvar commands. For
example, info level 1 will return a list describing a command that is either the outermost procedure call or the outermost namespace eval
command. Also, uplevel #0 evaluates a script at top-level in the outermost namespace (the global namespace).
EXAMPLE
As stated above, the uplevel command is useful for creating new control constructs. This example shows how (without error handling) it can
be used to create a do command that is the counterpart of while except for always performing the test after running the loop body:
proc do {body while condition} {
if {$while ne "while"} {
error "required word missing"
}
set conditionCmd [list expr $condition]
while {1} {
uplevel 1 $body
if {![uplevel 1 $conditionCmd]} {
break
}
}
}
SEE ALSO
namespace(1T), upvar(1T)
KEYWORDS
context, level, namespace, stack frame, variables
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWTcl |
+--------------------+-----------------+
|Interface Stability | Uncommitted |
+--------------------+-----------------+
NOTES
Source for Tcl is available on http://opensolaris.org.
Tcl uplevel(1T)