Sponsored Content
Top Forums Shell Programming and Scripting Compare 2 files and output only the different text. Post 302491048 by hakermania on Wednesday 26th of January 2011 03:08:29 PM
Old 01-26-2011
Tools Compare 2 files and output only the different text.

I know the diff does this but it does output more info than just the different text
(e.g.
Code:
$ diff file1 file2
29a30
> /home/alex/Pictures/hello.jpg
1694a1696
> /home/alex/Pictures/hi.jpg

)
How can I make it output only
/home/alex/Pictures/hello.jpg
/home/alex/Pictures/hi.jpg
?
thank you!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Compare Files and Output Difference

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

Compare 2 files and send output to other

Hi, In File1.txt I have text like: 23AA3424DD23|3423ff25sd5345| and so on In File2.txt I have similar text as File1, but with ",": 23aa3424dd23,192.168.1.100, and so on I wan to remove the pipes from File1 and select 5 fields, then remove "," from File2.txt and select 2 fields (IP's... (14 Replies)
Discussion started by: cameleon
14 Replies

3. Shell Programming and Scripting

compare 2 files > output new to third

Hi, I have a question of comparing to files and output the result third file where file1 is the mainfile containing processed dir data and 2nd file grepīs dirīs data again (could be newer dirs comparing file1<file2) now i wanna make shure that output in file3 only contains newer dirs hx... (1 Reply)
Discussion started by: needle
1 Replies

4. Shell Programming and Scripting

compare files in two directories and output changed files to third directory

I have searched about 30 threads, a load of Google pages and cannot find what I am looking for. I have some of the parts but not the whole. I cannot seem to get the puzzle fit together. I have three folders, two of which contain different versions of multiple files, dist/file1.php dist/file2.php... (4 Replies)
Discussion started by: bkeep
4 Replies

5. Shell Programming and Scripting

Compare two files and get output

Hi, I have two files, file1 and file2 and I need to compare them by line (exact match, order of the lines is not important) and get output with lines from file2 that are not found in file1 (not other way around). How do I do that? With grep or otherwise.. Thankyou (2 Replies)
Discussion started by: orp56
2 Replies

6. Shell Programming and Scripting

Compare two text files and output difference

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

7. UNIX for Dummies Questions & Answers

Compare two files and output to new file

Hi, Please help How to compare two files- Any mismatches 2nd and 3rd column's values corresponding to 1st column. file1 15294024|Not Allowed|null 15291398|Not Allowed|null 15303292|Dropship (standard)|N 15303291|Dropship (standard)|N 15275561|Store Only|Y 15275560|Store Only|Y... (2 Replies)
Discussion started by: Ankita Talukdar
2 Replies

8. UNIX for Dummies Questions & Answers

To compare two files,Output into a new file

Hi Please help me to compare two files and output into a new file file1.txt 15114933 |4001 15291649 |933502 15764675 |4316 15764678 |4316 15761974 |282501 15673104 |933505 15673577 |933505 15673098 |933505 15673096 |933505 15673092 |933505 15760705 ... (13 Replies)
Discussion started by: Ankita Talukdar
13 Replies

9. Shell Programming and Scripting

Compare output of UNIX command and match data to text file

I am working on an outage script and I run a command from the command line which tells me the amount of generator failures in my market. The output of this command only gives me three digits to identify the site by. I have a master list of all sites in a separate file, call it list.txt. If my... (7 Replies)
Discussion started by: jbrass
7 Replies

10. UNIX for Beginners Questions & Answers

Compare two files and print output

Hi All, i am trying to compare two files in Centos 6. F1: /tmp/d21 NAME="xvda" TYPE="disk" SIZE="40G" OWNER="root" GROUP="disk" MODE="brw-rw----" MOUNTPOINT="" NAME="xvda1" TYPE="part" SIZE="500M" OWNER="root" GROUP="disk" MODE="brw-rw----" MOUNTPOINT="/boot" NAME="xvda2" TYPE="part"... (2 Replies)
Discussion started by: balu1234
2 Replies
alex(1) 						      General Commands Manual							   alex(1)

NAME
alex - extract addresses from message headers (only available within the message handling system, mh) SYNOPSIS
alex [+folder] [msgs] [options] OPTIONS
Accepts an address that you type in, rather than taking an address from a message. If any -field option is specified, it is ignored. Spec- ifies the name of the alias file, in which aliases are placed. You must provide a file name or a dash (-) as an argument with this option. There is no default value. If the value given for this option is -, or the option is not specified, alex will print the output to your screen. If you do not give the full pathname of your alias file, alex will look for the alias file in your Mail directory, as specified in the Path field of your file. If alex cannot locate the alias file in the directory that you specify, it will ask you whether or not you wish to create one. You can set up an alias file to be used by alex in your mh_profile(4) for more information. Like other mail commands, alex uses the Aliasfile entry to find the alias file. Prevents any repetition of the same address in the output of an alex command. You can use this option when there are multiple occurrences of an address in an address group and you want just one occurrence of it in your alias. The default is -nocompress. Specifies the name of a header field. The name of the field is not case-sensitive. If you spec- ify this option without providing an argument, the default values are: -field reply-to/sender/from/to. You can set up your own default values for the -field option in your mh_profile(4). Examples of field names are From, cc and To. You must not type a colon after the name of a field. When more field names follow, in the form /name, the message header is searched for each of the fields in turn until one is found. Only the first header field found to contain an address is used; the rest are ignored. The option -nofield excludes the named field. The special name, all, means all fields, and can be used as a value for the -nofield option to override any default order of header fields, otherwise -field values are appended to any default values. Specifies that any address replacements or appendings will apply to all occurrences of that alias name. Normally, if an alias name is entered in the alias file more than once, any actions performed by alex are performed only on the first occurrence of that alias name. The -global option ensures that any changes are made to all occurrences of the alias. Whenever this option is specified, a message is broadcast to your screen telling you how many entries in the alias file have been changed. Prints a list of the valid options for this command. Specifies the alias name for address information extracted. The alex command appends a colon (:) to the name as required by mh-alias(4). If you do not specify this option,alex will print extracted addresses to your screen. If you specify this option, you must provide an argument; there is no default value. Extracts addresses interactively. Before adding each address of a list of extracted addresses to an alias group, the mail system will ask you whether you wish the address to be added. The query prompt is written on the standard error output. The default is -noquery. Replaces existing alias with the new list of addresses. By default, if there is an existing alias with the same name as the one you are trying to create, alex appends the new address list to the old alias. If an address appears in both address groups, it is still appended, so that it appears twice in the new alias. You can specify this explicitly by using the -nore- place option. If you specify the -replace option, the new list of addresses replaces the existing group. The default is -noreplace. Specifies the maximum width of your alias file line. If an alias group extends beyond this length, it is continued on the next line, with a backslash () at end of the first line. Any X.400 addresses which are longer than the maximum line length specified by this option are automatically wrapped onto the next line. This option affects the format of each individual entry when it is implemented; any subsequent or previous entries in the alias file remain the same. The default is 72 characters. DESCRIPTION
The address line extraction utility alex extracts electronic mail addresses from message headers and prints the addresses on your screen or places them, with a specified alias name, in an alias file. By default, alex searches for addresses in the current message in the current folder. You can list the messages you wish alex to search giving a msgs argument. You can also search messages in a different folder by giving a +folder argument. You define the fields from which you want addresses by using combinations of field names with the -field option. You can also supply an address yourself as a value to the -address option. Results are printed either to your screen or to a file in mh-alias(4) format. Where there is an address group in the alias file with an alias name identical to one you have specified in an alex command, it may be replaced or the new addresses appended. A copy of the original alias file is kept. By default, alex searches the Reply-to:, Sender:, From: and To: header fields in that order until an address is found. You can set up your own default values for alex in your file; see mh_profile(4). When giving options to the alex command, generally the shortest unique abbreviation suffices. RESTRICTIONS
Because the -nofield option can take the value all as an argument, alex will not recognize a header field called All. If you wish to use such a header field, you should call it X-all. If a command line contains contradictory arguments then the last value specified is used. For example, in the following command, alex only uses the options -name fred and -noreplace: % alex -name sam -name fred -replace -noreplace EXAMPLES
This example takes the address from the From field of the current message, and places it in your alias file with the alias name bob: % alex -field from -alias aliases -name bob The following example shows what happens if you specify an alias file that does not exist. You are asked whether you want to create the file; enter y to create it: % alex -field from -name bob -alias aliases Create alias file "HOME/Mail/aliases"? y The next example takes addresses from two fields, From and cc, and saves them as the alias sales_team: % alex -field from -field cc -alias aliases -name sales_team FILES
Your user profile. SEE ALSO
ali(1), mh(1), pick(1), mh-alias(4), mh_profile(4) alex(1)
All times are GMT -4. The time now is 01:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy