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)
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT DEBIAN
data::optlist
Data::OptList(3pm) User Contributed Perl Documentation Data::OptList(3pm)NAME
Data::OptList - parse and validate simple name/value option pairs
VERSION
version 0.107
SYNOPSIS
use Data::OptList;
my $options = Data::OptList::mkopt([
qw(key1 key2 key3 key4),
key5 => { ... },
key6 => [ ... ],
key7 => sub { ... },
key8 => { ... },
key8 => [ ... ],
]);
...is the same thing, more or less, as:
my $options = [
[ key1 => undef, ],
[ key2 => undef, ],
[ key3 => undef, ],
[ key4 => undef, ],
[ key5 => { ... }, ],
[ key6 => [ ... ], ],
[ key7 => sub { ... }, ],
[ key8 => { ... }, ],
[ key8 => [ ... ], ],
]);
DESCRIPTION
Hashes are great for storing named data, but if you want more than one entry for a name, you have to use a list of pairs. Even then, this
is really boring to write:
$values = [
foo => undef,
bar => undef,
baz => undef,
xyz => { ... },
];
Just look at all those undefs! Don't worry, we can get rid of those:
$values = [
map { $_ => undef } qw(foo bar baz),
xyz => { ... },
];
Aaaauuugh! We've saved a little typing, but now it requires thought to read, and thinking is even worse than typing... and it's got a bug!
It looked right, didn't it? Well, the "xyz => { ... }" gets consumed by the map, and we don't get the data we wanted.
With Data::OptList, you can do this instead:
$values = Data::OptList::mkopt([
qw(foo bar baz),
xyz => { ... },
]);
This works by assuming that any defined scalar is a name and any reference following a name is its value.
FUNCTIONS
mkopt
my $opt_list = Data::OptList::mkopt($input, \%arg);
Valid arguments are:
moniker - a word used in errors to describe the opt list; encouraged
require_unique - if true, no name may appear more than once
must_be - types to which opt list values are limited (described below)
name_test - a coderef used to test whether a value can be a name
(described below, but you probably don't want this)
This produces an array of arrays; the inner arrays are name/value pairs. Values will be either "undef" or a reference.
Positional parameters may be used for compatibility with the old "mkopt" interface:
my $opt_list = Data::OptList::mkopt($input, $moniker, $req_uni, $must_be);
Valid values for $input:
undef -> []
hashref -> [ [ key1 => value1 ] ... ] # non-ref values become undef
arrayref -> every name followed by a non-name becomes a pair: [ name => ref ]
every name followed by undef becomes a pair: [ name => undef ]
otherwise, it becomes [ name => undef ] like so:
[ "a", "b", [ 1, 2 ] ] -> [ [ a => undef ], [ b => [ 1, 2 ] ] ]
By default, a name is any defined non-reference. The "name_test" parameter can be a code ref that tests whether the argument passed it is
a name or not. This should be used rarely. Interactions between "require_unique" and "name_test" are not yet particularly elegant, as
"require_unique" just tests string equality. This may change.
The "must_be" parameter is either a scalar or array of scalars; it defines what kind(s) of refs may be values. If an invalid value is
found, an exception is thrown. If no value is passed for this argument, any reference is valid. If "must_be" specifies that values must
be CODE, HASH, ARRAY, or SCALAR, then Params::Util is used to check whether the given value can provide that interface. Otherwise, it
checks that the given value is an object of the kind.
In other words:
[ qw(SCALAR HASH Object::Known) ]
Means:
_SCALAR0($value) or _HASH($value) or _INSTANCE($value, 'Object::Known')
mkopt_hash
my $opt_hash = Data::OptList::mkopt_hash($input, $moniker, $must_be);
Given valid "mkopt" input, this routine returns a reference to a hash. It will throw an exception if any name has more than one value.
EXPORTS
Both "mkopt" and "mkopt_hash" may be exported on request.
AUTHOR
Ricardo Signes <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.12.3 2011-05-12 Data::OptList(3pm)