Sponsored Content
Full Discussion: sed and egrep in perl
Top Forums Shell Programming and Scripting sed and egrep in perl Post 302778529 by ptappeta on Monday 11th of March 2013 07:09:11 AM
Old 03-11-2013
sed and egrep in perl

Hi i have a data file whcih contains the data as follows :

Code:
FH332OY86|AAABBB CCCC DDDA FHLMC 30 8.000|FHLMC|3|30|8.00000000|1986|26.29164289|3.29544844|0.00000000|10.05940539|107.50704264|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAC|201302
FH332OY87|AAABBB CCCC DDDA FHLMC 30 8.000|FHLMC|3|30|8.00000000|1987|25.59725593|4.03243180|0.00000000|8.60684509|108.96588429|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAC|201302
FH332OY88|AAABBB CCCC DDDA FHLMC 30 8.000|FHLMC|3|30|8.00000000|1988|24.91666667|5.08333333|0.00000000|9.16500000|110.99727000|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAC|201302
FN112OY12|AAABBB CCCC DDDA FNMA 10 3.000|FNMA|23|10|3.00000000|2012|0.93679640|8.87642584|0.00000000|3.41606507|105.27375086|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAC|201302
FN112OY12|AAABBB CCCC DDDA FNMA 15 3.000|FNMA|5|15|3.00000000|2012|0.73128584|14.05295511|0.00000000|3.43542813|105.18244536|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAE|201302
FN114OY10|AAABBB CCCC DDDA FNMA 15 3.500|FNMA|5|15|3.50000000|2010|2.28459632|12.23354007|0.00000000|3.92717106|106.09882219|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAE|201302
FN114OY10|AAABBB CCCC DDDA FNMA 10 3.500|FNMA|23|10|3.50000000|2010|2.61217598|7.01039864|0.00000000|4.00370780|105.86328000|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAE|201302

now i need to filter out the lines which have the same first column and remove one line out of them which contains "FNMA 15" .in other words i need the final file to be

Code:
FH332OY86|AAABBB CCCC DDDA FHLMC 30 8.000|FHLMC|3|30|8.00000000|1986|26.29164289|3.29544844|0.00000000|10.05940539|107.50704264|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAC|201302
FH332OY87|AAABBB CCCC DDDA FHLMC 30 8.000|FHLMC|3|30|8.00000000|1987|25.59725593|4.03243180|0.00000000|8.60684509|108.96588429|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAC|201302
FH332OY88|AAABBB CCCC DDDA FHLMC 30 8.000|FHLMC|3|30|8.00000000|1988|24.91666667|5.08333333|0.00000000|9.16500000|110.99727000|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAC|201302
FN112OY12|AAABBB CCCC DDDA FNMA 10 3.000|FNMA|23|10|3.00000000|2012|0.93679640|8.87642584|0.00000000|3.41606507|105.27375086|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAC|201302
FN114OY10|AAABBB CCCC DDDA FNMA 10 3.500|FNMA|23|10|3.50000000|2010|2.61217598|7.01039864|0.00000000|4.00370780|105.86328000|Mar  8 2013 12:00AM|20130311|D|DA|DAA|DAAE|201302

could you please suggest how to do this ?

The above is only sample data .
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

egrep vs. sed backreference

My egrep outputs this: $ cat html.out|sed -n '/bluetext/s/&nbsp;/ /gp'|egrep '{5}' <span class="bluetext"><b> Lexington Park, MD 20653</b></span> But my backreference \1 is empty. I dont understand why. Can someone clarify? $ cat html.out|sed -n '/bluetext/s/&nbsp;/ /gp'|sed -n... (1 Reply)
Discussion started by: r0sc0
1 Replies

2. UNIX for Dummies Questions & Answers

Egrep cheat sheet anywhere? Looking for meaning of egrep -c

Hi I've been searching google and have not found what egrep -c means. Does anyone know where I can get a cheat sheet or what that -c means? thanks, Linda (2 Replies)
Discussion started by: leelm
2 Replies

3. Shell Programming and Scripting

[Perl] Accessing array elements within a sed command in Perl script

I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows: $count = 0; while ( $count < $#test ) { `sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`; `cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies

4. Shell Programming and Scripting

Perl or awk/egrep from big files??

Hi experts. In one thread i have asked you how to grep the string from the below sample file- Unfortunately the script did not gave proper output (it missed many strings). It happened may be i did gave you the proper contents of the file That was the script- "$ perl -00nle'print join... (13 Replies)
Discussion started by: thepurple
13 Replies

5. Shell Programming and Scripting

running egrep in perl script ?

Hi there if i run this from the BASH command line, i get a good result # FS="my-box23/account" # zfs list -t filesystem -H | cut -f1 |egrep "^ZPpool1/$FS$" ZP0pool1/my-box23/account which is great, however if I try to run in a perl script populating an array with the result/s, i get... (4 Replies)
Discussion started by: rethink
4 Replies

6. Shell Programming and Scripting

Formatting problem with cat, egrep and perl

Hi guys I'm using the following script to change input file format to another format. some where I'm getting the error. Could you please let me know if you find out? cat input.txt|egrep -v ‘^#'|\ perl -ane ‘if (@F>3){$_=~/(chr.+):(\d+)\ s()/;print $1,”\t”,$2,”\t”,($2+35),”\n”}'\ > output.bed ... (1 Reply)
Discussion started by: repinementer
1 Replies

7. Shell Programming and Scripting

Patterns with egrep/sed/awk?

I have an array with characters, what I want is if there are other characters in the array which I am looking for than take action that is print BAD ARRAY. So far my code just finds characters but instead I want that it should look for other characters. echo "A B C D F" | egrep -o "D | F" O/P... (5 Replies)
Discussion started by: dixits
5 Replies

8. Shell Programming and Scripting

Perl match multiple numbers from a variable similar to egrep

I want to match the number exactly from the variable which has multiple numbers seperated by pipe symbol similar to search in egrep.below is the code which i tried #!/usr/bin/perl my $searchnum = $ARGV; my $num = "148|1|0|256"; print $num; if ($searchnum =~ /$num/) { print "found"; }... (2 Replies)
Discussion started by: kar_333
2 Replies

9. Shell Programming and Scripting

sed and egrep question

Its really 2 questions, but both are pretty basic. Linux Redhat 1. Need to do a search and replace on a file. I need to append '--' (comment out the line) to specific lines based on a wildcard search. So if I Have GRANT SOME_ROLE_OR_USER ... I dont care what comes after that.... (2 Replies)
Discussion started by: guessingo
2 Replies

10. Shell Programming and Scripting

Rewrite sed to perl or run sed in perl

I am having trouble re-writing this sed code sed -nr 's/.*del(+)ins(+).*NC_0{4}(+).*g\.(+)_(+).*/\3\t\4\t\5\t\1\t\2/p' C:/Users/cmccabe/Desktop/Python27/out_position.txt > C:/Users/cmccabe/Desktop/Python27/out_parse.txt in perl Basically, what the code does is parse text from two fields... (12 Replies)
Discussion started by: cmccabe
12 Replies
Tspi_TPM_DAA_JoinInit(3)				     Library Functions Manual					  Tspi_TPM_DAA_JoinInit(3)

						     TCG Software Stack Developer's Reference

NAME
Tspi_TPM_DAA_JoinInit - start the DAA Join process SYNOPSIS
#include <tss/tss_typedef.h> #include <tss/tss_structs.h> #include <tss/tspi.h> TSPICALL Tspi_TPM_DAA_JoinInit( TSS_HDAA hDAA, TSS_HTPM hTPM, TSS_HKEY issuer_pk, UINT32 issuer_authentication_PKLength, TSS_HKEY* issuer_authentication_PK, UINT32 issuer_authentication_PK_signaturesLength, BYTE** issuer_authentication_PK_signatures, UINT32* capital_UprimeLength, BYTE** capital_Uprime, TSS_DAA_IDENTITY_PROOF* identity_proof, TSS_DAA_JOIN_SESSION* join_session ); DESCRIPTION
Tspi_TPM_DAA_JoinInit is the first out of 3 functions to execute in order to receive a DAA Credential. It verifies the keys of the DAA Is- suer and computes the TPM DAA public key. PARAMETERS
hDAA The hDAA parameter is used to specify the handle of the DAA object. hTPM The hTPM parameter is the handle to the TPM object. issuer_pk The issuer_pk parameter is the of the DAA Issuer public key. issuer_authentication_PKLength The issuer_authentication_PKLength parameter is the length of the array of issuerAuthPKs. issuer_authentication_PK The issuer_authentication_PK parameter is an array of RSA public keys (key chain) of the DAA Issuer used to authenticate the DAA Issuer public key. The size of the modulus must be TPM_DAA_SIZE_issuerModulus (256). issuer_authentication_PK_signaturesLength The issuer_authentication_PK_signaturesLength parameter is the length of the array of issuerAuthPKSignatures. It is equal to issuerAuthPKsLength. The length of an element of the array is TPM_DAA_SIZE_issuerModulus (256). issuer_authentication_PK_signatures The issuer_authentication_PK_signatures parameter is the array of byte arrays representing signatures on the modulus of the above key chain (issuerAuthPKs) in more details, the array has the following content (S(K[1],K[0]),S(K[2],N[1]),..S(K[ k ],K[n-1]), S(TPM_DAA_ISSUER,K[ k ])), where S(msg,privateKey) denotes the signature function with msg being signed by the privateKey. capital_UprimeLength The capital_UprimeLength parameter is the length of capitalUprime which is ln/8. ln is defined as the size of the RSA modulus (2048). capital_Uprime The capital_Uprime parameter is U'. identityProof The identityProof parameter is a structure containing the endorsement, platform and conformance credential. joinSession The joinSession parameter is a structure containing DAA Join session information. RETURN CODES
Tspi_TPM_DAA_JoinInit returns TSS_SUCCESS on success, otherwise one of the following values is returned: TSS_E_INVALID_HANDLE Either the DAA or the TPM handler is not valid. TSS_E_BAD_PARAMETER TSS_E_INTERNAL_ERROR An internal SW error has been detected. TSS_E_DAA_ISSUER_KEY_ERROR CONFORMING TO
Tspi_TPM_DAA_JoinInit conforms to the Trusted Computing Group Software Specification version 1.2 SEE ALSO
Tspi_TPM_DAA_JoinCreateDaaPubKey(3) Tspi_TPM_DAA_JoinStoreCredential(3) TSS 1.2 2006-09-04 Tspi_TPM_DAA_JoinInit(3)
All times are GMT -4. The time now is 11:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy