Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Count multiple columns and print original file Post 302998149 by Scrutinizer on Friday 26th of May 2017 07:24:01 AM
Old 05-26-2017
Try something like this:
Code:
awk '
  NR == FNR {
    a[$1,$2,$3] = $4
    next 
  }

  ($5,$6,$7) in a {
    if ($22 == a[$5,$6,$7]){
      print
    }
    next
  }

  {
    $22="Unknown"
    print
  }
' FS='\t' OFS='\t' file1.txt file2.txt > output.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

mv command to rename multiple files that retain some portion of the original file nam

Well the title is not too good, so I will explain. I need to move (rename) files using a simple AIX script. ???file1.txt ???file2.txt ???file1a.txt ???file2a.txt to be: ???renamedfile1'date'.txt ???renamedfile2'date'.txt ???renamedfile1a'date'.txt ???renamedfile2a'date'.txt ... (4 Replies)
Discussion started by: grimace15
4 Replies

2. Shell Programming and Scripting

awk command to print multiple columns

Hello Team, I have written following command which is giving output is as shown below. bash-3.00$ grep -i startup catalina.out | tail +2 | sed -n 1p | awk -F" " '{ for (x=1; x<=5; x++) { printf"%s\n", $x } }' Dec 19, 2010 3:28:39 PM bash-3.00$ I would like to modify above command to... (2 Replies)
Discussion started by: coolguyamy
2 Replies

3. Linux

Find and print in multiple columns

Hi all, My input file is : 0 13400000 sil 13400000 14400000 a 14400000 14900000 dh 14900000 15300000 a 15300000 16500000 R 16500000 17000000 k 17000000 17300000 u 17300000 17600000 th 17600000 17900000 sil 17900000 18400000 th 18400000 18900000 a 18900000 19600000 g 19600000 19900000... (1 Reply)
Discussion started by: girlofgenuine
1 Replies

4. Shell Programming and Scripting

Match ids and print original file

Hello, I have two files Original: ( 5000 entries) Chr Position chr1 879108 chr1 881918 chr1 896874 ... and a file with allele freq ( 2000 entries) Chr Position MAF chr1 881918 0.007 chr1 979748 0.007 chr1... (9 Replies)
Discussion started by: nans
9 Replies

5. UNIX for Dummies Questions & Answers

Split a column into multiple columns at certain character count

Hey everyone, I have an issue with a client that is passing me a list of values in one column, and occasionally the combination of all the values results in more than an 255 character string. My DB has a 255 character limit, so I am looking to take the column (comma delimited file), and if it... (1 Reply)
Discussion started by: perekl
1 Replies

6. Shell Programming and Scripting

Compare columns of multiple files and print those unique string from File1 in an output file.

Hi, I have multiple files that each contain one column of strings: File1: 123abc 456def 789ghi File2: 123abc 456def 891jkl File3: 234mno 123abc 456def In total I have 25 of these type of file. (5 Replies)
Discussion started by: owwow14
5 Replies

7. Programming

awk to count occurrence of strings and loop for multiple columns

Hi all, If i would like to process a file input as below: col1 col2 col3 ...col100 1 A C E A ... 3 D E G A 5 T T A A 6 D C A G how can i perform a for loop to count the occurences of letters in each column? (just like uniq -c ) in every column. on top of that, i would also like... (8 Replies)
Discussion started by: iling14
8 Replies

8. Shell Programming and Scripting

Awk: is it possible to print into multiple columns?

Hi guys, I have hundreds file like this, here I only show two of them: file 1 feco4_s_BB95.log ZE_1=-1717.5206260 feco4_t_BB95.log ZE_1=-1717.5169250 feco5_s_BB95.log ZE_1=-1830.9322060... (11 Replies)
Discussion started by: liuzhencc
11 Replies

9. UNIX for Beginners Questions & Answers

Print multiple columns in scientific notation

Hi everybody, I have file 1 with 15 columns, I want to change the formatting of the numbers of columns 10,11 and 12 in the scientific notation. I used the Following script: awk '{print $10}' file1.dat | awk '{printf "%.2e\n", $1}' > file2.dat awk '{print $11}' file1.dat | awk '{printf... (7 Replies)
Discussion started by: supernono06
7 Replies

10. UNIX for Beginners Questions & Answers

How to print multiple required columns dynamically in a file using the header name?

Hi All, i am trying to print required multiple columns dynamically from a fie. But i am able to print only one column at a time. i am new to shell script, please help me on this issue. i am using below script awk -v COLT=$1 ' NR==1 { for (i=1; i<=NF; i++) { ... (2 Replies)
Discussion started by: balu1234
2 Replies
TWADMIN(8)						      System Manager's Manual							TWADMIN(8)

NAME
twadmin - Tripwire administrative and utility tool SYNOPSIS
twadmin { -m F | --create-cfgfile } options... configfile.txt twadmin { -m f | --print-cfgfile } [ options... ] twadmin { -m P | --create-polfile } [ options... ] policyfile.txt twadmin { -m p | --print-polfile } [ options... ] twadmin { -m R | --remove-encryption } [ options... ] file1 [ file2... ] twadmin { -m E | --encrypt } [ options... ] file1 [ file2... ] twadmin { -m e | --examine } [ options... ] file1 [ file2... ] twadmin { -m G | --generate-keys } options... DESCRIPTION
The twadmin utility is used to perform certain administrative functions related to Tripwire files and configuration options. Specifically, twadmin allows encoding, decoding, signing, and verification of Tripwire files, and provides a means to generate and change local and site keys. Creating a configuration file (--create-cfgfile) This command mode designates an existing text file as the new configuration file for Tripwire. The plain text configuration file must be specified on the command line. Using the site key, the new configuration file is encoded and saved. Printing a configuration file (--print-cfgfile) This command mode prints the specified encoded and signed configuration file in clear-text form to standard output. Replacing a policy file (--create-polfile) This command mode designates an existing text file as the new policy file for Tripwire. The plain text policy file must be specified on the command line. Using the site key, the new policy file is encoded and saved. Printing a policy file (--print-polfile) This command mode prints the specified encoded and signed policy file in clear-text form to standard output. Removing encryption from a file (--remove-encryption) This command mode allows the user to remove signing from signed configuration, policy, database, or report files. Multiple files may be specified on the command line. The user will need to enter the appropriate local or site keyfile, or both if a combination of files is to be verified. Even with the cryptographic signing removed, these files will be in a binary encoded (non-human-readable) form. Encrypting a file (--encrypt) This command mode allows the user to sign configuration, policy, database files, or reports. Multiple files may be specified on the com- mand line. The files will be signed using either the site or local key, as appropriate for the type of file. To automate the process, the passphrase for the key files can be included on the command line. Examining the signing status of a file (--examine) This command allows the user to examine the listed files and print a report of their signing status. This report displays the filename, file type, whether or not a file is signed, and what key (if any) is used to sign it. Generating keys (--generate-keys) This command mode generates site and/or local key files with names specified by the user. OPTIONS
Creating a configuration file: -m F --create-cfgfile -v --verbose -s --silent, --quiet -c cfgfile --cfgfile cfgfile -S sitekey --site-keyfile sitekey -Q passphrase --site-passphrase passphrase -e --no-encryption configfile.txt -m F, --create-cfgfile Mode selector. -v, --verbose Verbose output mode. Mutually exclusive with (-s). -s, --silent, --quiet Silent output mode. Mutually exclusive with (-v). -c cfgfile, --cfgfile cfgfile Specify the destination of the encoded (and optionally signed) configuration file. -S sitekey, --site-keyfile sitekey Use the specified site key file to encode and sign the new configuration file. Exactly one of (-S) or (-e) must be specified. -Q passphrase, --site-passphrase passphrase Specifies passphrase to be used with site key for configuration file encoding and signing. Valid only in conjunction with (-S). -e, --no-encryption Do not sign the configuration file being stored. The configuration file will still be compressed, and will not be human-readable. Mutually exclusive with (-Q) and (-S). configfile.txt Specifies the text configuration file that will become the new configuration file. __________________________________________________________________________________________________________________________________________________ Printing a configuration file: -m f --print-cfgfile -v --verbose -s --silent, --quiet -c cfgfile --cfgfile cfgfile -m f, --print-cfgfile Mode selector. -v, --verbose Verbose output mode. Mutually exclusive with (-s). -s, --silent, --quiet Silent output mode. Mutually exclusive with (-v). -c cfgfile, --cfgfile cfgfile Print the specified configuration file. __________________________________________________________________________________________________________________________________________________ Creating a policy file: -m P --create-polfile -v --verbose -s --silent, --quiet -c cfgfile --cfgfile cfgfile -p polfile --polfile polfile -S sitekey --site-keyfile sitekey -Q passphrase --site-passphrase passphrase -e --no-encryption policyfile.txt -m P, --create-polfile Mode selector. -v, --verbose Verbose output mode. Mutually exclusive with (-s). -s, --silent, --quiet Silent output mode. Mutually exclusive with (-v). -c cfgfile, --cfgfile cfgfile Use the specified configuration file. -p polfile, --polfile polfile Specify the destination of the encoded (and optionally signed) policy file. -S sitekey, --site-keyfile sitekey Use the specified site key file. Mutually exclusive with (-e). -Q passphrase, --site-passphrase passphrase Specifies passphrase to be used with site key for policy signing. Mutually exclusive with (-e). -e, --no-encryption Do not sign the policy file being stored. The policy file will still be compressed, and will not be human-readable. Mutually ex- clusive with (-Q) and (-S). policyfile.txt Specifies the text policy file that will become the new policy file. __________________________________________________________________________________________________________________________________________________ Printing a policy file: -m p --print-polfile -v --verbose -s --silent, --quiet -c cfgfile --cfgfile cfgfile -p polfile --polfile polfile -S sitekey --site-keyfile sitekey -m p, --print-polfile Mode selector. -v, --verbose Verbose output mode. Mutually exclusive with (-s). -s, --silent, --quiet Silent output mode. Mutually exclusive with (-v). -c cfgfile, --cfgfile cfgfile Use the specified configuration file. -p polfile, --polfile polfile Print the specified policy file. -S sitekey, --site-keyfile sitekey Use the specified site key file. __________________________________________________________________________________________________________________________________________________ Removing encryption from a file: -m R --remove-encryption -v --verbose -s --silent, --quiet -c cfgfile --cfgfile cfgfile -L localkey --local-keyfile localkey -S sitekey --site-keyfile sitekey -P passphrase --local-passphrase passphrase -Q passphrase --site-passphrase passphrase file1 [ file2... ] -m R, --remove-encryption Mode selector. -v, --verbose Verbose output mode. Mutually exclusive with (-s). -s, --silent, --quiet Silent output mode. Mutually exclusive with (-v). -c cfgfile, --cfgfile cfgfile Use the specified configuration file. -L localkey, --local-keyfile localkey Specify the local keyfile to use to verify database files and reports. -S sitekey, --site-keyfile sitekey Specify the site keyfile to use to verify configuration and policy files. -P passphrase, --local-passphrase passphrase Specify the passphrase to use when verifying with the old local keyfile. -Q passphrase, --site-passphrase passphrase Specify the passphrase to use when verifying with the old site keyfile. file1 [ file2... ] List of files from which signing is to be removed. __________________________________________________________________________________________________________________________________________________ Encrypting a file: -m E --encrypt -v --verbose -s --silent, --quiet -c cfgfile --cfgfile cfgfile -L localkey --local-keyfile localkey -S sitekey --site-keyfile sitekey -P passphrase --local-passphrase passphrase -Q passphrase --site-passphrase passphrase file1 [ file2... ] -m E, --encrypt Mode selector. -v, --verbose Verbose output mode. Mutually exclusive with (-s). -s, --silent, --quiet Silent output mode. Mutually exclusive with (-v). -c cfgfile, --cfgfile cfgfile Use the specified configuration file. -L localkey, --local-keyfile localkey Specify the local keyfile to use to sign database files and reports. -S sitekey, --site-keyfile sitekey Specify the site keyfile to use to sign configuration and policy files. -P passphrase, --local-passphrase passphrase Specify the passphrase to use when signing with the local keyfile. -Q passphrase, --site-passphrase passphrase Specify the passphrase to use when signing with the site keyfile. file1 [ file2... ] List of files to sign using the new key(s). __________________________________________________________________________________________________________________________________________________ Examining the encryption status of a file: -m e --examine -v --verbose -s --silent, --quiet -c cfgfile --cfgfile cfgfile -L localkey --local-keyfile localkey -S sitekey --site-keyfile sitekey file1 [ file2... ] -m e, --examine Mode selector. -v, --verbose Verbose output mode. Mutually exclusive with (-s). -s, --silent, --quiet Silent output mode. Mutually exclusive with (-v). -c cfgfile, --cfgfile cfgfile Use the specified configuration file. -L localkey, --local-keyfile localkey Specifies the key to use as a local key. -S sitekey, --site-keyfile sitekey Specifies the key to use as a site key. file1 [ file2... ] List of files to examine. __________________________________________________________________________________________________________________________________________________ Generating keys: -m G --generate-keys -v --verbose -s --silent, --quiet -L localkey --local-keyfile localkey -S sitekey --site-keyfile sitekey -P passphrase --local-passphrase passphrase -Q passphrase --site-passphrase passphrase -m G, --generate-keys Mode selector. -v, --verbose Verbose output mode. Mutually exclusive with (-s). -s, --silent, --quiet Silent output mode. Mutually exclusive with (-v). -L localkey, --local-keyfile localkey Generate the local key into the specified file. At least one of (-L) or (-S) must be specified. -S sitekey, --site-keyfile sitekey Generate the site key into the specified file. At least one of (-S) or (-L) must be specified. -P passphrase, --local-passphrase passphrase Specify local passphrase to be used when generating the local key. -Q passphrase, --site-passphrase passphrase Specify site passphrase to be used when generating the site key. VERSION INFORMATION
This man page describes twadmin version 2.3.1. AUTHORS
Tripwire, Inc. COPYING PERMISSIONS
Permission is granted to make and distribute verbatim copies of this man page provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this man page under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc. Copyright 2000 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights re- served. SEE ALSO
twintro(8), tripwire(8), twprint(8), siggen(8), twconfig(4), twpolicy(4), twfiles(5) 1 July 2000 TWADMIN(8)
All times are GMT -4. The time now is 02:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy