Sponsored Content
Top Forums Shell Programming and Scripting Diff command file entries in different lines Post 302784921 by ajayram on Saturday 23rd of March 2013 02:31:12 PM
Old 03-23-2013
Diff command file entries in different lines

Hello,

I have two files to compare these contain some contents like this :

FIle 1 :
A
B
C
E

File 2 has some new entries and the old entries are in some different ordre

File 2 could be like this :
C
E
A
B
G
I

How can I use diff command to only get the entries in file 2 that are new , so I dont want to know at which line the files differ, but only the entries in 2 that do not match any entries in 1.??

Note : These files provided here are just examples, but in reality the size of 1 and 2 could be very large, (say 900 entries or more)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

diff 2 files; output diff's to 3rd file

Hello, I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3. For example: file 1 123 1234 123456 file 2 123 2345 23456 file 3 should have 2345 23456 I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies

2. UNIX for Dummies Questions & Answers

Maximum input file size in "Diff" Command

Hello, Can anyone let me know what is the maximum file size that can be given as input for the "Diff" Command in Unix? I have a file size as large as 28MB and which can also increase. Will I face any issues with such a file size. If yes, What is the other alternative. Thanks in advance for... (1 Reply)
Discussion started by: Neeraja
1 Replies

3. Shell Programming and Scripting

diff lines from 2 files in a while loop

Okie I have two files. file1 with input asdf_s45 fdsa_s20 jkl_s32 lkj_s3 and file2 with input asdf_s44 fdsa_s19 jkl_s31 lkj_s2 now I have counted the total number of lines in the file and put it in a variable so num_lines=4 now I have a while loop to repeat a diff command... (6 Replies)
Discussion started by: bigboizvince
6 Replies

4. Shell Programming and Scripting

awk/sed Command : Parse parameter file / send the lines to the ksh export command

Sorry for the duplicate thread this one is similar to the one in https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121 Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies

5. Shell Programming and Scripting

counting the lines of diff files in loop

i have two file. i want to count the lines of each file one by one in loop and compare it. can any one pls help me on this? (1 Reply)
Discussion started by: Aditya.Gurgaon
1 Replies

6. Shell Programming and Scripting

Diff Command to return the number of lines inserted,deleted and changed.

Hello, I have to compare two files file1 and file2, retrieve the number of lines modified (added, deleted or modified) in file2. Output must be like: File2: Added Deleted Changed Total ------ ------- -------- ----- 2 1 1 4 Somebody... (2 Replies)
Discussion started by: nmattam
2 Replies

7. Shell Programming and Scripting

Show entire lines with diff command

Hi, When I run the diff command using diff -yt file1 file2, I get the output in which original lines are truncated. I tried using -W switch with diff. However, that does not produce exact output as I want. Is it possible to show entire line of file1 and file2 in diff command's output? ... (8 Replies)
Discussion started by: jal_capri
8 Replies

8. Shell Programming and Scripting

Help in replacing two blank lines with two diff data

Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script... I used sed to search a line and insert two blank lines after the searchd line using the following sed command. Sed "/data/{G;G;}/" filename. In the file, after data tag, two lines got inserted blank lines.. Now... (1 Reply)
Discussion started by: arjun_arippa
1 Replies

9. Shell Programming and Scripting

Help in replacing two blank lines with two lines of diff data

Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script... I used sed to search a line and insert two blank lines after the searchd line using the following sed command. sed "/data/{G;G;}/" filename . In the file, after data tag, two lines got inserted blank lines..... (4 Replies)
Discussion started by: arjun_arippa
4 Replies

10. Shell Programming and Scripting

Git diff exclude swapped lines

Hi, I am doing aws security group auditing every day to find the difference. I am using git to find the difference. But some times some security group rules order is changing up and down(swapping lines). So 'git diff' command gives this as a difference which i dont want(i need only new lines... (2 Replies)
Discussion started by: jobycxa
2 Replies
getacl(2)							System Calls Manual							 getacl(2)

NAME
getacl, fgetacl - get access control list (ACL) information (HFS File Systems only) SYNOPSIS
DESCRIPTION
returns a complete listing of all ACL entries (uid.gid, mode) in an existing file's access control list. path points to a path name of a file. Similarly, returns a complete listing of all ACL entries for an open file known by the file descriptor fildes. nentries is the number of entries being reported on, and is never more than the constant defined in If nentries is non-zero, it must be at least as large as the number of entries in the file's ACL, including base entries (see setacl(2)). returns the number of entries in the file's ACL, as well as the ACL entries themselves in the array of structures acl declared by the calling program. If nentries is zero, returns the number of entries in the file's ACL, including base ACL entries, and acl is ignored. Entries are reported in groups of decreasing order of specificity (see setacl(2)), then sorted in each group by user ID and group ID. The content of array entries beyond the number of defined entries for the file is undefined. RETURN VALUE
Upon successful completion, and return a non-negative value. If an error occurs, a value of -1 is returned, and is set to indicate the error. ERRORS
fails to modify the acl array if any of the following is true: A component of the path prefix is not a directory. The named file does not exist (for example, path is null or a component of path does not exist). A component of the path prefix denies search permission. path or a portion of acl to be written points outside the allocated address space of the process. nentries is non-zero and less than the number of entries in the file's ACL, or it is greater than is not supported on remote files by some networking services. The function is not supported by this file system type. The system file table is full. The length of path exceeds bytes, or the length of a component of path exceeds bytes while is in effect. Too many symbolic links were encountered in translating the path name. fails to modify the acl array if any of the following is true: fildes is not a valid file descriptor. nentries is non-zero and less than the number of entries in the file's ACL, or it is greater than The function is not supported by this file system type. The system file table is full. EXAMPLES
The following call returns the number of entries in the ACL on file The following call returns in acl all entries in the ACL on the file opened with file descriptor 5. DEPENDENCIES
and are only supported on HFS file system on standard HP-UX operating system. AUTHOR
and were developed by HP. SEE ALSO
access(2), chmod(2), getaccess(2), setacl(2), stat(2), privileges(5), unistd(5). getacl(2)
All times are GMT -4. The time now is 08:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy