Sponsored Content
Top Forums Shell Programming and Scripting Unix file operations(shell script) Post 302165224 by nivas on Thursday 7th of February 2008 05:26:05 AM
Old 02-07-2008
Unix file operations(shell script)

Hi,

I want to compare two files. Files will look like as follows:

file1:
ASDFGHJU|1234567890123456
QWERTYUI|3456789098900890
file2:
ZXCVBVNM|0987654321234567
POLKIJUYH|1234789060985478

output file should be:
ASDFGHJU|1234567890123456
QWERTYUI|3456789098900890


Thnaks in advance
nivas
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unix File operations

Hi, Iam having the two files as follows: file1: ASQWEDFR09876543121234512 POIUYTREW09876512345676788 ZXCVBNMKS1209888888888888 file2: ASQWEDFR09876543121234516 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990---- CXADFGTU09876543121234789 asdcvfgbtg@abc.com ... (14 Replies)
Discussion started by: nivas
14 Replies

2. Shell Programming and Scripting

file operations in shell scripting

hi All, my query... 1.I Have to search for the files in the root directory. 2.i have to search for a pattern in all the files in the root directory and then replace them with a new pattern. 3.Rename the file Explanation: if ABC is the root folder and has 3 subfolders and there are 15... (9 Replies)
Discussion started by: adityamahi
9 Replies

3. Shell Programming and Scripting

(Urgent):Creating flat file using sql script and sqlplus from UNIX Shell Script

Hi, I need help urgently for following issue. Pls help me to resolve this issue. I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql) I given... (6 Replies)
Discussion started by: praka
6 Replies

4. Shell Programming and Scripting

Need help is manipulating a file with some arithmetic operations using bash script

Friends, I have a file with contents like: interface Serial0/4/0/0/1/1/1/1:0 encapsulation mfr multilink group 101 Now I need to manipulate the file in such a way that to all the numbers less than 163, 63 gets added and to all numbers greater than 163, 63 gets deducted.(The numbers... (2 Replies)
Discussion started by: shrijith1
2 Replies

5. Shell Programming and Scripting

Execute unix shell script to text file using the script

Hi all, I am beginner in UNIX...I want to use unix shell script to create text.file...I know how to use using by command...can anybody tell me for the script? Thanks i changed the threads title from "tex file" to "text file", because "tex" would probably be misunderstood as reference to... (4 Replies)
Discussion started by: mastercar
4 Replies

6. Shell Programming and Scripting

Help on shell script (string operations)

Hey everyone. So the background of the problem is that the ps3 does not support the mkv container, but DOES support the avi one. Here is the script to convert one file with the name hardcoded in: #!/bin/sh mencoder -oac... (2 Replies)
Discussion started by: wua05
2 Replies

7. Shell Programming and Scripting

How to search and append words in the same file using unix scripting file operations

Hi , I have a file myhost.txt which contains below, 127.0.0.1 localhost 1.17.1.5 atrpx958 11.17.10.11 atrpx958zone nsybhost I need to append words only after "atrpx958" like 'myhost' and 'libhost' and not after atrpx958zone. How to search the word atrpx958(which is hostname) only,... (5 Replies)
Discussion started by: gsreeni
5 Replies

8. UNIX for Dummies Questions & Answers

File operations are failing inside the script

Hi, does any one know the environmental parameter that I have to set so as to make sure the file operations run properly within the script. right now when I am doing a cat from within the script nothing happens, same is the case when I do a grep. when I am doing awk '{print $0 }' its printing... (1 Reply)
Discussion started by: ahmedwaseem2000
1 Replies

9. Shell Programming and Scripting

To skip operations in UNIX shell

hi i am having a acript for which i need to skip the execution of some lines and to continue with remaining lines for eg script.sh rm text for i in * do . . . . . if then rm i want to skip the execution of the lines and to start with (11 Replies)
Discussion started by: rohit_shinez
11 Replies
diff3(1)						      General Commands Manual							  diff3(1)

Name
       diff3 - 3-way differential file comparison

Syntax
       diff3 [-ex3] file1 file2 file3

Description
       The command compares three versions of a file, and publishes the ranges of text that disagree, flagged with the following codes:

	  ====	      all three files differ

	  ====1       file1 is different

	  ====2       file2 is different

	  ====3       file3 is different

       The type of change needed to convert a given range of a given file to some other is indicated in one of these ways:

	  f : n1 a    Text is to be appended after line number n1 in file f, where f = 1, 2, or 3.

	  f : n1 , n2 c
		      Text is to be changed in the range line n1 to line n2.  If n1 = n2, the range may be abbreviated to n1.

       The original contents of the range follows immediately after a c indication.  When the contents of two files are identical, the contents of
       the lower-numbered file is suppressed.

Options
       -3   Produces an editor script containing the changes between file1 and file2 that are to be incorporated into file3.

       -e	   Produces an editor script containing the changes between file2 and file3 that are to be incorporated into file1.

       -x	   Produces an editor script containing the changes among all three files.

Examples
       Under the -e option, publishes a script for the editor that incorporates into file1 all changes between file2 and  file3  -  that  is,  the
       changes	that would normally be flagged ==== and ====3.	Option -x (-3) produces a script to incorporate only changes flagged ==== (====3).
       The following command applies the resulting script to `file1':
       (cat script; echo '1,$p') | ed - file1

Restrictions
       Text lines that consist of a single `.'	defeat -e.

Files
       /tmp/d3?????
       /usr/lib/diff3

See Also
       cmp(1), comm(1), diff(1), dffmk(1), join(1), sccsdiff(1), uniq(1)

																	  diff3(1)
All times are GMT -4. The time now is 05:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy