a) <file redirection is not too much more efficient than your for loop. It really just saves one process (cat). The best is to avoid shell loop and run the file through a filter, like awk.
And since you're not using find(1) to do anything super useful, it can be omitted as well. Something along these lines:
This will print the commands to stdout. Look at it, take one, and execute it, and if everythinh seems well, pipe it to bash and capture the output to a file:
b) if you omit double quotes and you're searching for a 2-word pattern, grep takes second word as the file to do search on:
Hi have Input in this way
KEY AAAA
BBBB
END1
KEY AAAA
BBBB
END2
KEY AAAA
BBBB
END3
I need to find any thing matching in between KEY And ending with "END1|END2|END3"
This didnot work
awk '/KEY/,/END1|END2|END3/' (3 Replies)
I was google searching and found
Perl as a command line utility tool
This almost solves my problem:
find . | xargs perl -p -i.old -e 's/oldstring/newstring/g'
I think this would create a new file for every file in my directory tree. Most of my files will not contain oldstring and I... (1 Reply)
I need to search for a particular string. This string might be present in many files. The directory in which I am present has more than one subdirectories. Hence, the search should check in all the subdirectories and all the corresponding files and give a list of files which have the particular... (5 Replies)
Hi Everybody,
I am just new to UNIX as well as to this forum. I have a text file with 10,000 coloumns and each coloumn contains values separated by space. I want to separate them into new coloumns..the file is something like this
as ad af 1 A
as ad af 1 D
...
...
1 and A are in one... (7 Replies)
Hi There...
I need to serach and replace a strings in a text file.
My file has; books.amazon='Let me read' and the output needed is
books.amazon=NONFOUND
pls if anybody know this can be done in script sed or awk.. i have a list of different strings to be repced by NONFOUND.... (7 Replies)
I am trying to do the following task :
export ENV=aaa
export ENV_PATH=$(cd /apps | ls | grep $ENV)
However, it's not working. What's the way to change to directory and search some file in that directory in single command
Please help. (2 Replies)
Based on the forums i have tried with grep command but i am unable to get the required output.
search this value /*------
If that is found then search for temp_vul and print
and also search until /*------- and print new_vul
Input file contains:
... (5 Replies)
Hi guys,
I have a text file named file1.txt that is formatted like this:
001 , ID , 20000
002 , Name , Brandon
003 , Phone_Number , 616-234-1999
004 , SSNumber , 234-23-234
005 , Model , Toyota
007 , Engine ,V8
008 , GPS , OFF
and I have file2.txt formatted like this:
... (2 Replies)
Hi All,
I hope somebody would be able to help me.
I would need to search a string coming from a file, example file.txt:
dog
cat
goat
horse
fish
For every string, I would need to know if there are any files inside a directory(recursively) that contains the string regardless of case.... (9 Replies)
Here is my sample file data:
My requirement is to have a regex expression that is able to search for visible starting string "SSLInsecureRenegotiation Off" between strings "<VirtualHost " and "</VirtualHost>".
In the sample data two lines should be matched.
Below is what I tried but... (5 Replies)
Discussion started by: mohtashims
5 Replies
LEARN ABOUT DEBIAN
x500::dn
DN(3pm) User Contributed Perl Documentation DN(3pm)NAME
X500::DN - handle X.500 DNs (Distinguished Names), parse and format them
SYNOPSIS
use X500::DN;
my $dn = X500::DN->ParseRFC2253 ('cn=John Doe, o=Acme\, Inc., c=US') or die;
print $dn->getRFC2253String(), "
";
$dn = new X500::DN (new X500::RDN ('c'=>'US'), new X500::RDN ('cn'=>'John Doe'));
my $rdn0 = $dn->getRDN(0);
my $c = $rdn0->getAttributeValue ('c');
NOTE
The RFC 2253 syntax is explicitely backwards in relation to the ASN.1 SEQUENCE.
So the RFC 2253 string "cn=John Doe, c=US" has the same meaning as the X.500 string "c=US, cn=John Doe". The X500::DN objects keep the
RDNs in X.500 order!
DESCRIPTION
This module handles X.500 DNs (Distinguished Names). Currently, it parses DN strings formatted according to RFC 2253 syntax into an
internal format and produces RFC 2253 formatted string from it.
Methods
o $object = new X500::DN (rdn, rdn, ...);
Creates a DN object from zero or more arguments of type X500::RDN.
o $object = X500::DN->ParseRFC2253 ('cn=John Doe, o=Acme\, Inc., c=US');
Creates a DN object from an RFC 2253 formatted DN string notation.
o $object->getRFC2253String();
Returns the DN as a string formatted according to RFC 2253 syntax.
o $object->getOpenSSLString();
Returns the DN as a string formatted suitable for "openssl req -subj" and "openssl ca -subj".
o $object->getX500String();
Returns the DN as a string formatted according to X.500 syntax. NOTE: This is a hack, there is no definition for a X.500 string
syntax!
o $object->hasMultivaluedRDNs();
Returns whether the DN contains multi-valued RDNs.
o $object->getRDN (num);
Returns the DN's RDN at position num as an X500::RDN object. num starts with 0, which will return the first RDN in ASN.1 SEQUENCE
order.
o $object->getRDNs();
Returns the DN's RDNs, a list of objects of type X500::RDN, in ASN.1 SEQUENCE order.
EXPORT
None.
BUGS
o Due to Parse::RecDescent's greedyness, white space after attribute values gets into the parsed value. It might be possible to work
around this.
AUTHOR
Robert Joop <yaph-070708@timesink.de>
COPYRIGHT
Copyright 2002 Robert Joop. All Rights reserved. This program is free software; you can redistribute it and/or modify it under the same
terms as Perl itself.
SEE ALSO
X500::RDN, perl.
HISTORY
Early 2002: First idea, discussed on comp.lang.perl.moderated
April 2002: First public release, 0.15
perl v5.10.0 2007-07-08 DN(3pm)