Sponsored Content
Top Forums Shell Programming and Scripting cut, sed, awk too slow to retrieve line - other options? Post 302484238 by anurag.singh on Thursday 30th of December 2010 08:35:29 AM
Old 12-30-2010
Code:
awk -F= 'NR==FNR{a[$1]=$2;next}{if(a[$1]) print $2;}' file1 file2

Output for above file1 and file2 (values of key2 and key4):
Code:
value2_2_1
value2_2_2
value2_4_1

Is this the expected output? If not, pls post the expected one.
This User Gave Thanks to anurag.singh For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cut vs. sed vs. awk ?

hi again...need new help guys:p the file contains following infos... users/abc/bla1.exe newusers/defgh/ik/albg2.exe users2/opww/ertz/qqwertzu/rwerwew.exe how to get the file content into... users/abc/ newusers/defgh/ik/ users2/opww/ertz/qqwertzu/ with... you can erase the... (5 Replies)
Discussion started by: svennie
5 Replies

2. Shell Programming and Scripting

Text cut between two $ in a line with SED

Let's say I have a line like that: I want to cut out numbers between two $ including $s. The result should be like that: I am so-newbei. I am non-stop reading about SED since yesterday and not a programmer. I know that it is a short period, thus maybe I had overlooked something. I... (4 Replies)
Discussion started by: l_p
4 Replies

3. UNIX for Dummies Questions & Answers

retrieve lines using sed, grep or awk

Hi, I'm looking for a command to retrieve a block of lines using sed or grep, probably awk if that can do the job. In below example, By searching for words "Third line2" i'm expecting to retrieve the full block starting with 'BEGIN' and ending with 'END' of the search. Example: ... (3 Replies)
Discussion started by: learning_linux
3 Replies

4. Shell Programming and Scripting

How to retrieve digital string using sed or awk

Hi, I have filename in the following format: YUENLONG_20070818.DMP HK_20070818_V0.DMP WANCHAI_20070820.DMP KWUNTONG_20070820_V0.DMP How to retrieve only the digital part with sed or awk and return the following format: 20070818 20070818 20070820 20070820 Thanks! Victor (3 Replies)
Discussion started by: victorcheung
3 Replies

5. Shell Programming and Scripting

sed/awk to retrieve max year in column

I am trying to retrieve that max 'year' in a text file that is delimited by tilde (~). It is the second column and the values may be in Char format (double quoted) and have duplicate values. Please help. (4 Replies)
Discussion started by: CKT_newbie88
4 Replies

6. Shell Programming and Scripting

Line/Variable Editing for Awk sed Cut

Hello, i have a file, i open the file and read the line, i want to get the first item in the csv file and also teh third+6 item and wirte it to a new csv file. only problem is that using echo it takes TOO LONG: please help a newbie. below is my code: WorkingDir=$1 FileName=`cut -d ',' -f... (2 Replies)
Discussion started by: limamichelle
2 Replies

7. Shell Programming and Scripting

awk script file command line options

Being new to awk I have a really basic question. It just has to be in the archives but it didn't bite me when I went looking for it. I've written an awk script, placed it in a file, added the "#!/usr/bin/awk -f" at the top of the script and away I go. "% myAwk <inputfile>" gives me exactly what... (2 Replies)
Discussion started by: tomr2k
2 Replies

8. Shell Programming and Scripting

sed or awk, cut, to extract specific data from line

Hi guys, I have been trying to do this, but... no luck so maybe you can help me. I have a line like this: Total Handled, Received, on queue Input Mgs: 140 / 14 => 0 I need to, get the number after the / until the =, to get only 14 . Any help is greatly appreciated. Thanks, (4 Replies)
Discussion started by: ocramas
4 Replies

9. Shell Programming and Scripting

Retrieve information Text/Word from HTML code using awk/sed

awk/sed newbie here. I have a HTML file and from that file and I would like to retrieve a text word. <font face=arial size=-1><li><a href=/value_for_clients/Tokyo/abc_process.txt>abc</a> NDK Version: 4.0 </li> <font face=arial size=-1><li><a... (6 Replies)
Discussion started by: sk2code
6 Replies

10. Shell Programming and Scripting

awk - To retrieve an expression from the last line containing a pattern

Hi All, I'm new on this forum, and i'm trying since several days to find out a way to retrieve a expression from the last line containing a pattern. Could you please help me with this ? E.g. The file is containing the following lines 08/05 17:33:47 STAT1 Response(22) is... (4 Replies)
Discussion started by: Antonio Fargas
4 Replies
Mail::DKIM::PrivateKey(3)				User Contributed Perl Documentation				 Mail::DKIM::PrivateKey(3)

NAME
Mail::DKIM::PrivateKey - a private key loaded in memory for DKIM signing SYNOPSIS
my $key1 = Mail::DKIM::PrivateKey->load( File => "/path/to/private.key"); my $key2 = Mail::DKIM::PrivateKey->load( Data => $base64); # use the loaded key in a DKIM signing object my $dkim = Mail::DKIM::Signer->new( Key => $key2, ); CONSTRUCTOR
load() - loads a private key into memory my $key1 = Mail::DKIM::PrivateKey->load( File => "/path/to/private.key"); Loads the Base64-encoded key from the specified file. my $key2 = Mail::DKIM::PrivateKey->load(Data => $base64); Loads the Base64-encoded key from a string already in memory. my $key3 = Mail::DKIM::PrivateKey->load(Cork => $openssl_object); Creates a Mail::DKIM::PrivateKey wrapper object for the given OpenSSL key object. The key object should be of type Crypt::OpenSSL::RSA. METHODS
cork() - access the underlying OpenSSL key object $openssl_object = $key->cork; The returned object is of type Crypt::OpenSSL::RSA. sign_digest() Cryptographically sign the given message digest. $key->sign_digest("SHA-1", sha1("my message text")); The first parameter is the name of the digest: one of "SHA-1", "SHA-256". The second parameter is the message digest as a binary string. The result should be the signed digest as a binary string. AUTHOR
Jason Long, <jlong@messiah.edu> COPYRIGHT AND LICENSE
Copyright (C) 2006-2008 by Messiah College This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available. perl v5.12.1 2010-03-01 Mail::DKIM::PrivateKey(3)
All times are GMT -4. The time now is 10:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy