Sponsored Content
Full Discussion: compare two txt files
Top Forums Shell Programming and Scripting compare two txt files Post 302089922 by anbu23 on Thursday 21st of September 2006 11:42:19 AM
Old 09-21-2006
Code:
awk '
FILENAME == "f1" { arr[$0]++}
FILENAME == "f2" { if ( arr[$0] != 1 ) { print "f2:" $0 ;delete arr[$0]}
                  else  delete arr[$0]
                }
END {
for ( key in arr ) print "f1:" key
}' f1 f2

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

echo "ABC" > file1.txt file2.txt file3.txt

Hi Guru's, I need to create 3 files with the contents "ABC" using single command. Iam using: echo "ABC" > file1.txt file2.txt file3.txt the above command is not working. pls help me... With Regards / Ganapati (4 Replies)
Discussion started by: ganapati
4 Replies

2. UNIX for Dummies Questions & Answers

Compare and Remove duplicate lines from txt

Hello, I am a total linux newbie and I can't seem to find a solution to this little problem. I have two text files with a huge list of URLS. Let's call them file1.txt and file2.txt What I want to do is grab an URL from file2.txt, search file1.txt for the URL and if found, delete it from... (11 Replies)
Discussion started by: rmarcano
11 Replies

3. Solaris

list files .txt and .TXT in one command

Dear experts, In a directory i have both *.TXT and *.txt files. I have a script- for file in `ls *.txt`; do mv $file /tmp/$file How to list both *.txt and*.TXT file in one command so that script will move both .txt or .TXT whatever it find. br//purple (4 Replies)
Discussion started by: thepurple
4 Replies

4. Shell Programming and Scripting

Compare two txt files

Hi, I want to compare two txt files and output the matches to a file. For example I have FILE1 - accounts1.txt Peter norman elektra table CHAIR Newman nOvice FILE2 - accounts2.txt noland trainfil peter Newman norman neverlan CHAIR jackson KelSo (4 Replies)
Discussion started by: novice_sn6
4 Replies

5. Shell Programming and Scripting

Require compare command to compare 4 files

I have four files, I need to compare these files together. As such i know "sdiff and comm" commands but these commands compare 2 files together. If I use sdiff command then i have to compare each file with other which will increase the codes. Please suggest if you know some commands whcih can... (6 Replies)
Discussion started by: nehashine
6 Replies

6. Shell Programming and Scripting

moving the files in a.txt files to a different directory

HI All, I am coding a shell script which will pick all the .csv files in a particular directoryand write it in to a .txt file, this .txt file i will use as a source in datastage for processing. now after the processing is done I have to move and archive all the files in the .txt file to a... (5 Replies)
Discussion started by: subhasri_2020
5 Replies

7. Shell Programming and Scripting

Using csh / awk / sed to compare database sizes in a txt file

Hello, I have an output file showing database sizes across the 3 environments that I use (LIVE, TEST & DEVELOPMENT). I am trying to write a script that lets me know if the size of a db on one environment is different to its corresponding db on the other environments. Here is an example... (4 Replies)
Discussion started by: stevie_g
4 Replies

8. UNIX for Dummies Questions & Answers

How to tar all files except logs and .txt files

Hi I greatly appreciate the forum and the people here very helpful :) I could able to tar all the directories, sub dirs and the files. But unable to tar all the directories excluding the log and text files. Can anyone please advise the exact command to use for excluding .log and .txt? PS:... (4 Replies)
Discussion started by: Olivia
4 Replies

9. Shell Programming and Scripting

Compare two txt files,mismatches will be in new txt files

Hi, Below are the sample data for txt files. txt file 1 Partnumber|catgroup_id 10001082|46016 10001093|4680 10001093|386003 10001093|463004 10003251|683 10003251|63005 10003252|463005 10003252|4683 10003260|463005 10003260|4683 10003264|4683 10003264|463005 13420000|67... (5 Replies)
Discussion started by: Ankita Talukdar
5 Replies

10. Shell Programming and Scripting

Find and compare values from different txt files

Hello, i am new in Bash. Actually i have a directory : /home/resultfiles and inside i have these txt files: 531_1.out.res, 531_2.out.res , 531_3.out.res 532_1.out.res, 532_2.out.res , 532_3.out.res 533_1.out.res, 533_2.out.res, 533_3.out.res All these txt files has this format : num_q all... (3 Replies)
Discussion started by: nimpoura
3 Replies
GET_DEFINED_VARS(3)							 1						       GET_DEFINED_VARS(3)

get_defined_vars - Returns an array of all defined variables

SYNOPSIS
array get_defined_vars (void ) DESCRIPTION
This function returns a multidimensional array containing a list of all defined variables, be them environment, server or user-defined variables, within the scope that get_defined_vars(3) is called. RETURN VALUES
A multidimensional array with all the variables. EXAMPLES
Example #1 get_defined_vars(3) Example <?php $b = array(1, 1, 2, 3, 5, 8); $arr = get_defined_vars(); // print $b print_r($arr["b"]); /* print path to the PHP interpreter (if used as a CGI) * e.g. /usr/local/bin/php */ echo $arr["_"]; // print the command-line parameters if any print_r($arr["argv"]); // print all the server vars print_r($arr["_SERVER"]); // print all the available keys for the arrays of variables print_r(array_keys(get_defined_vars())); ?> SEE ALSO
isset(3), get_defined_functions(3), get_defined_constants(3). PHP Documentation Group GET_DEFINED_VARS(3)
All times are GMT -4. The time now is 05:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy