Sponsored Content
Top Forums Shell Programming and Scripting Big pattern file matching within another pattern file in awk or shell Post 302960839 by RudiC on Friday 20th of November 2015 04:55:41 AM
Old 11-20-2015
Some comments on top of what Don Cragun said:
awk -F "," keys.txt '{print $1}' can't possibly work (reverse order of arguments) and is superfluous - you could simply read IFS="," key_ REST; ... < keys.txt
grep -v ",-1$" is pointless as (at least in the samples given) there's no line ending in "-1"
And, for each line in keys.txt times each matching line in file1.txt, you run 10 processes to extract a few fields - no surprise that is slow.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pattern matching for file

Hi All, I'm new to perl, My requirement is to check if particular file exists. e.g. filename.txt, filename1.txt, filename2.txt etc I tried the below code:- my $var1 = "filename.txt" if ( -e ($var1 = ~ /file\w/)) { print "File found \n"; } else { print "File not found \n"; } ... (0 Replies)
Discussion started by: doitnow
0 Replies

2. Programming

File Pattern Matching C++

Hi, I have large files with fixed length fields or fields seperated by delimeter. I would like to do validation on some or all fields to check for numeric or date or characters etc.. I would like to write this in C++. Please let me know if any one have any ideas on this. Thanks for all... (2 Replies)
Discussion started by: rameshmelam
2 Replies

3. UNIX for Dummies Questions & Answers

PERL pattern matching in a file

Hi Gurus, I have a file like below.. I have to match each with predefined pattern. If matches then have to write the entire record to a separate file. If not make the value as NULL and write the entire record into another file. | is the delimiter ravi123|2344|M R123Vi|2345|F... (8 Replies)
Discussion started by: pvksandeep
8 Replies

4. Shell Programming and Scripting

Help with matching pattern inside a file

I have a huge file that has roughly 30304 lines. I need to extract specific info from that file. For example, Box 1 > *aaaaaaaajjjj* > hbbvjvj > jdnnfddllll > *dgdfhfekwjh* Box 2 > *aaaaaaa'aj'jjj* > dse hkjuejef bfdw > dyeee > dsewq > *dgdfhfekwjh* >feweiuei Box 3 > *aaaa"aaaaj"jjj* >... (25 Replies)
Discussion started by: Ernst
25 Replies

5. Shell Programming and Scripting

Get matching string pattern from a file

Hi, file -> temp.txt cat temp.txt /home/pradeep/123/a_asp.html /home/pradeep/123/a_asp1.html /home/pradeep/435/a_asp2.html /home/pradeep/arun/abc/a_dfr.html /home/pradeep/arun/123/a_kir.html /home/pradeep/123/arun/a_dir.html .... .... .. i need to get a_*.html(bolded strings... (4 Replies)
Discussion started by: pradebban
4 Replies

6. Shell Programming and Scripting

AWK match $1 $2 pattern in file 1 to $1 $2 pattern in file2

Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match. I'm stuck in an AWK... (9 Replies)
Discussion started by: right_coaster
9 Replies

7. Shell Programming and Scripting

awk pattern matching and shell issue.

Please help me in this issue. I am unable to get the job,seems the awk not browsing the files. Please find my tries below. I have attached two files : 1.tobesearched.txt - a glimpse of a huge log file. 2.searchstring.txt - searching keys. these are the two scripts i tried writing: ... (7 Replies)
Discussion started by: deboprio
7 Replies

8. Shell Programming and Scripting

awk - writing matching pattern to a new file and deleting it from the current file

Hello , I have comma delimited file with over 20 fileds that i need to do some validations on. I have to check if certain fields are null and then write the line containing the null field into a new file and then delete the line from the current file. Can someone tell me how i could go... (2 Replies)
Discussion started by: goddevil
2 Replies

9. UNIX for Dummies Questions & Answers

How to append portion of a file content to another file when a certain pattern is matching?

Hi ladies and gentleman.. I have two text file with me. I need to replace one of the file content to another file if one both files have a matching pattern. Example: text1.txt: ABCD 1234567,HELLO_WORLDA,HELLO_WORLDB DCBA 3456789,HELLO_WORLDE,HELLO_WORLDF text2.txt: XXXX,ABCD... (25 Replies)
Discussion started by: bananamen
25 Replies

10. Shell Programming and Scripting

Awk: Matching Pattern From other file with length

Hi, I have input file whose first column needs(match.txt) to be matched with the first column of the input file with min & max length as defined in match.txt. But conditions are not matching. Please help on the changes in the code below as for multiple enteries in match.txt complete match.txt will... (3 Replies)
Discussion started by: siramitsharma
3 Replies
PAPERKEY(1)						      General Commands Manual						       PAPERKEY(1)

NAME
paperkey - extract secret information out of OpenPGP secret keys SYNOPSIS
paperkey [--secret-key=FILE] [--output=FILE] [--output-type=base16|raw] [--output-width=WIDTH] paperkey --pubring=FILE [--secrets=FILE] [--input-type=auto|base16|raw] [--output=FILE] [--ignore-crc-error] [--comment=STRING] [--file-format] paperkey --version MOTIVATION
As with all data, secret keys should be backed up. In fact, secret keys should be backed up even better than other data, because they are impossible to recreate should they ever be lost. All files encrypted to lost keys are forever (or at least for a long time) undecipher- able. In addition to keeping backups of secret key information on digital media such as USB-sticks or CDs it is reasonable to keep an if- all-else-fails copy on plain old paper, for use should your digital media ever become unreadable for whatever reason. Stored properly, paper is able to keep information for several decades or longer. With GnuPG, PGP, or other OpenPGP implementations the secret key usually contains a lot more than just the secret numbers that are impor- tant. They also hold all the public values of key pairs, user ids, expiration times and more. In order to minimize the information that has to be entered manually or with the help of OCR software, paperkey extracts just the secret information out of OpenPGP secret keys. For recovering a secret key it is assumed that the public key is still available, for instance from public internet keyservers. DESCRIPTION
paperkey has two modes of operation: The first mode creates "paperkeys" by extracting just the secret information from a secret key, formatting the data in a way suitable for printing or in a raw mode for further processing. The other mode rebuilds secret keys from such a paperkey and a copy of the public key, also verifying the checksums embedded in the paperkey. This mode is selected when the --pubring option is used, which is required in that case. If a passphrase was set on the origi- nal secret key, the same passphrase is set on the rebuilt key. Input is read from standard-in except when the --secret-key or --secrets option is used; output is printed to standard-out, unless changed with the --output option. SECURITY CONSIDERATIONS
Please note that paperkey does not change the protection and encryption status of and security requirements for storing your secret key. If the secret key was protected by a passphrase so is the paperkey. If the secret key was unprotected the paperkey will not be protected either. OPTIONS
--help, -h Display a short help message and exit successfully. --version, -V Print version information and copyright information and exit successfully. --verbose, -v Print status and progress information to standard-error while processing the input. Repeat for even more output. --output=FILE, -o Redirect output to the file given instead of printing to standard-output. --comment=STRING Include the specified comment in the base16 output. --file-format Paperkey automatically includes the file format it uses as comments at the top of the base16 output. This command simply prints out the file format and exits successfully. OPTIONS FOR EXTRACTING SECRET INFORMATION
--output-type=base16, --output-type=raw Select the output type. The base16 style encodes the information in the style of a classic hex-dump, including line numbers and per-line CRC checksums to facilitate localizing errors in the input file during the recovery phase. The raw, or binary, mode is just a raw dump of the secret information, intended for feeding to barcode generators or the like. --output-width=WIDTH Choose line width in the base16 output mode. The default is 78 characters. --secret-key=FILE File to read the secret key from. If this option is not given paperkey reads from standard-input. OPTIONS FOR RE-CREATING PRIVATE KEYS --input-type=auto, --input-type=base16, --input-type=raw Specify that the given input is either in base16 format, as produced by paperkey, or in raw format. The default, auto, tries to automatically detect the format in use. --pubring=FILE File to read public key information from. It is assumed that the user can get the public key from sources like public internet key- servers. --secrets=FILE File to read the extracted secrets, the paperkey, from. If this is not given then the information is read from standard-input. --ignore-crc-error Do not reject corrupt input and continue despite any CRC errors. EXAMPLES
Take the secret key in key.gpg and generate a text file to-be-printed.txt that contains the secret data: $ paperkey --secret-key my-secret-key.gpg --output to-be-printed.txt Take the secret key data in my-key-text-file.txt and combine it with my-public-key.gpg to reconstruct my-secret-key.gpg: $ paperkey --pubring my-public-key.gpg --secrets my-key-text-file.txt --output my-secret-key.gpg If --output is not specified, the output goes to stdout. If --secret-key is not specified, the data is read from stdin so you can do things like: $ gpg --export-secret-key my-key | paperkey | lpr SEE ALSO
gpg(1), http://www.jabberwocky.com/software/paperkey/ AUTHORS
paperkey is written by David Shaw <dshaw@jabberwocky.com>. PAPERKEY
January 2008 PAPERKEY(1)
All times are GMT -4. The time now is 01:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy