Sponsored Content
Top Forums Shell Programming and Scripting AWK Compare files, different fields, output Post 302469811 by stacky69 on Monday 8th of November 2010 07:54:18 AM
Old 11-08-2010
ACE!!! Thanks bud

Worked a treat. exclamation eh!!! should have checked that one out myself Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies

2. UNIX for Dummies Questions & Answers

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies

3. Shell Programming and Scripting

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (3 Replies)
Discussion started by: yerruhari
3 Replies

4. Shell Programming and Scripting

Compare fields in 2 files using AWK

Hi unix gurus, I have a urgent requirement, I need to write a AWK script to compare each fields in 2 files using AWK. Basically my output should be like this. file1 row|num1|num2|num3 1|one|two|three 2|one|two|three file2 row|num1|num2|num3 1|one|two|three 2|one|two|four ... (5 Replies)
Discussion started by: rashmisb
5 Replies

5. Shell Programming and Scripting

awk to compare diff output by fields

Diff output as follows: < AAA BBB CCC DDD EEE 123 > PPP QQQ RRR SSS TTT 111 > VVV WWW XXX YYY ZZZ 333 > AAA BBB CCC DDD EEE 124 How can i use awk to compare the last field to determine if the counter has increased, and need to ensure that the first 4 fields must have the same... (15 Replies)
Discussion started by: ux4me
15 Replies

6. Shell Programming and Scripting

Compare two files and output difference, by first field using awk.

It seems like a common task, but I haven't been able to find the solution. vitallog.txt 1310,John,Hancock 13211,Steven,Mills 122,Jane,Doe 138,Thoms,Doe 1500,Micheal,May vitalinfo.txt 12122,Jane,Thomas 122,Janes,Does 123,Paul,Kite **OUTPUT** vitalfiltered.txt 12122,Jane,Thomas... (2 Replies)
Discussion started by: charles33
2 Replies

7. Shell Programming and Scripting

awk help: Match data fields from 2 files & output results from both into 1 file

I need to take 2 input files and create 1 output based on matches from each file. I am looking to match field #1 in both files (Userid) and create an output file that will be a combination of fields from both file1 and file2 if there are any differences in the fields 2,3,4,5,or 6. Below is an... (5 Replies)
Discussion started by: ambroze
5 Replies

8. Shell Programming and Scripting

awk - compare 1st 15 fields of record with 20 fields

I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Discussion started by: sljnk
7 Replies

9. Shell Programming and Scripting

Compare 2 files and find missing fields awk

Hello experts! I have 2 files. file1 is a list file containing uniquely names. e.g.: name1 number number name2 number number name5 number number name10 number number ... file2 is a data file arbitrary containing the names of file1 in paragraphs separated by "10" e.g. name4 ... (3 Replies)
Discussion started by: phaethon
3 Replies

10. UNIX for Beginners Questions & Answers

Is there a UNIX command that can compare fields of files with differing number of fields?

Hi, Below are the sample files. x.txt is from an Excel file that is a list of users from Windows and y.txt is a list of database account. $ head -500 x.txt y.txt ==> x.txt <== TEST01 APP_USER_PROFILE USER03 APP_USER_PROFILE TEST02 APP_USER_EXP_PROFILE TEST04 APP_USER_PROFILE USER01 ... (3 Replies)
Discussion started by: newbie_01
3 Replies
NFS4_SETFACL(1) 					    NFSv4 Access Control Lists						   NFS4_SETFACL(1)

NAME
nfs4_setfacl, nfs4_editfacl - manipulate NFSv4 file/directory access control lists SYNOPSIS
nfs4_setfacl [OPTIONS] COMMAND file... nfs4_editfacl [OPTIONS] file... DESCRIPTION
nfs4_setfacl manipulates the NFSv4 Access Control List (ACL) of one or more files (or directories), provided they are on a mounted NFSv4 filesystem which supports ACLs. nfs4_editfacl is equivalent to nfs4_setfacl -e. Refer to the nfs4_acl(5) manpage for information about NFSv4 ACL terminology and syntax. COMMANDS -a acl_spec [index] add the ACEs from acl_spec to file's ACL. ACEs are inserted starting at the indexth position (DEFAULT: 1) of file's ACL. -A acl_file [index] add the ACEs from the acl_spec in acl_file to file's ACL. ACEs are inserted starting at the indexth position (DEFAULT: 1) of file's ACL. -x acl_spec | index delete ACEs matched from acl_spec - or delete the indexth ACE - from file's ACL. Note that the ordering of the ACEs in acl_spec does not matter. -X acl_file delete ACEs matched from the acl_spec in acl_file from file's ACL. Note that the ordering of the ACEs in the acl_spec does not mat- ter. -s acl_spec set file's ACL to acl_spec. -S acl_file set file's ACL to the acl_spec in acl_file. -e, --edit edit file's ACL in the editor defined in the EDITOR environment variable (DEFAULT: vi(1)) and set the resulting ACL upon a clean exit, assuming changes made in the editor were saved. Note that if multiple files are specified, the editor will be serially invoked once per file. -m from_ace to_ace modify file's ACL in-place by replacing from_ace with to_ace. -?, -h, --help display help text and exit. --version display this program's version and exit. NOTE: if '-' is given as the acl_file with the -A/-X/-S flags, the acl_spec will be read from stdin. OPTIONS -R, --recursive recursively apply to a directory's files and subdirectories. Similar to setfacl(1), the default behavior is to follow symlinks given on the command line and to skip symlinks encountered while recursing through directories. -L, --logical in conjunction with -R/--recursive, a logical walk follows all symbolic links. -P, --physical in conjunction with -R/--recursive, a physical walk skips all symbolic links. --test display results of COMMAND, but do not save changes. PERMISSIONS ALIASES
With nfs4_setfacl, one can use simple abbreviations ("aliases") to express generic "read" (R), generic "write" (W), and generic "execute" (X) permissions, familiar from the POSIX mode bits used by, e.g., chmod(1). To use these aliases, one can put them in the permissions field of an NFSv4 ACE and nfs4_setfacl will convert them: an R is expanded to rntcy, a W is expanded to watTNcCy (with D added to directory ACEs), and an X is expanded to xtcy. Please refer to the nfs4_acl(5) manpage for information on specific NFSv4 ACE permissions. For example, if one wanted to grant generic "read" and "write" access on a file, the NFSv4 permissions field would normally contain some- thing like rwatTnNcCy. Instead, one might use aliases to accomplish the same goal with RW. The two permissions not included in any of the aliases are d (delete) and o (write-owner). However, they can still be used: e.g., a per- missions field consisting of Wdo expresses generic "write" access as well as the ability to delete and change ownership. EXAMPLES
Assume that the file `foo' has the following NFSv4 ACL for the following examples: A::OWNER@:rwatTnNcCy D::OWNER@:x A:g:GROUP@:rtncy D:g:GROUP@:waxTC A::EVERYONE@:rtncy D::EVERYONE@:waxTC - add ACE granting `alice@nfsdomain.org' generic "read" and "execute" access (defaults to prepending ACE to ACL): $ nfs4_setfacl -a A::alice@nfsdomain.org:rxtncy foo - add the same ACE as above, but using aliases: $ nfs4_setfacl -a A::alice@nfsdomain.org:RX foo - edit existing ACL in a text editor and set modified ACL on clean save/exit: $ nfs4_setfacl -e foo - set ACL (overwrites original) to contents of a spec_file named `newacl.txt': $ nfs4_setfacl -S newacl.txt foo - recursively set the ACLs of all files and subdirectories in the current directory, skipping all symlinks encountered, to the ACL con- tained in the spec_file named `newacl.txt': $ nfs4_setfacl -R -P -S newacl.txt * - delete the first ACE, but only print the resulting ACL (does not save changes): $ nfs4_setfacl --test -x 1 foo - delete the last two ACEs above: $ nfs4_setfacl -x "A::EVERYONE@rtncy, D::EVERYONE@:waxTC" foo - modify (in-place) the second ACE above: $ nfs4_setfacl -m D::OWNER@:x D::OWNER@:xo foo - set ACLs of `bar' and `frobaz' to ACL of `foo': $ nfs4_getfacl foo | nfs4_setfacl -S - bar frobaz AUTHORS
nfs4_setfacl was written by people at CITI, the Center for Information Technology Integration (http://www.citi.umich.edu). This manpage was written by David Richter. CONTACT
Please send bug reports, feature requests, and comments to <nfsv4@linux-nfs.org>. SEE ALSO
nfs4_getfacl(1), nfs4_acl(5), RFC3530 (NFSv4.0), NFSv4.1 Minor Version Draft. Linux version 0.3.3, August 2008 NFS4_SETFACL(1)
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy