To give you some context of my issue the following is some sample dummy data. The field delimiter is "<-->". The 4th field is going to be tags for my notes. The tags should always be unique and sorted alphabetically.
The goal is I want to be able to update a single tag across all my notes. The problem I'm having is I can't find a way to select only whole words. i.e. if I want to change the word "note" to "notez", on the 3rd line, "notes" is changed to "notezs".
How can I change only whole words from my field #4? I've tried awk's sub & index commands, different regular expressions and attempts to combine with sed. The environment I'm working in is ksh88 and I'd prefer to use just awk if possible. Perl sadly isn't an option.
i have an awk statement which i am using to count the number of occurences of the number ,5, in the file:
awk '/,5,/ {count++}' TRY.txt | awk 'END { printf(" Total parts: %d",count)}'
i know there is a total of 10 matches..what is wrong here?
thanks (16 Replies)
I’m trying to modify someone perl script to fix a bug. The piece of code checks that the zone name you want to add is unique. However, when the code runs, it finds a partial match using grep, and decides it already exists, so the “create” command exits.
$cstatus = `${ZADM} list -vic | grep... (3 Replies)
QUESTION1:
How do you grep only an exact string. I am using Solaris10 and do not have any GNU products installed.
Contents of car.txt
CAR1_KEY0
CAR1_KEY1
CAR2_KEY0
CAR2_KEY1
CAR1_KEY10
CURRENT COMMAND LINE: WHERE VARIABLE CAR_NUMBER=1 AND KEY_NUMBER=1
grep... (1 Reply)
Hello, my apologizes if the title is a bit confusing. I am currently working with a series of files that have the form:
2
3
7
17
21
However, I need to insert records such that I have:
0 0
1 0
2 1
3 1
4 0
5 0
6 0
7 1
.... And so on.
Currently I have the... (2 Replies)
I've seen dozens of similar threads but none seem to match what I'm looking for and I can't seem to make sense of how to do this so any help would be immensely appreciated.
I am running a command that generates this output:
Mike Smith
Mike Smith Alaska
Mike Smith Washington
Mike Smith Alaska... (6 Replies)
To match range, the command is:
awk '/BEGIN/,/END/'
but what I want is the range is printed only if there is additional pattern that matches in the range itself? maybe like this:
awk '/BEGIN/,/END/ if only in that range there is /pattern/'
Thanks (8 Replies)
hello masters,
I am working with csv files that open just fine in excel, but have sub-fields which are comma separated as well.
a 3 column csv looks like
a,b,"c,d,e"
f,g,h
How do I make join or sort believe that "c,d,e" is just 1 field? (8 Replies)
Hello masters,
Please help on the following.
I have a tab delimited file with subfields space delimited.
1 a b x y hhghd ghgf
2 v t f g gdgdgdg hghg
I have 3 lookup table files tab delimited, for fields 2,3 and 4 respectively
Lookup2
a 10
b 20
v 30
t 40
Lookup3 (12 Replies)
Dear All,
Here is my input
TAACGCACTTGCGGCCCCGGGATAAAAAAAAAAAAAAAAAAAAATGGATT
NAGAGGGACGGCCGGGGGCATAAAAAAAAAAAAAAAAAAAAAGGGATTTC
NGGGTTTTAAGCAGGAGGTGTCAAAAAAAAAAAAAAAAAAAAAGGGATTT
NTGGAACCTGGCGCTAGACCAAAAAAAAAAAAAAAAAAAATGGATTTTTG
ATACTTACCTGGCAGGGGAGATACCATGATCAATAAAAAAAAAAAAAAAA... (3 Replies)
Discussion started by: jacobs.smith
3 Replies
LEARN ABOUT DEBIAN
html::formhandler::field::repeatable
HTML::FormHandler::Field::Repeatable(3pm) User Contributed Perl Documentation HTML::FormHandler::Field::Repeatable(3pm)NAME
HTML::FormHandler::Field::Repeatable - repeatable (array) field
VERSION
version 0.40013
SYNOPSIS
In a form, for an array of hashrefs, equivalent to a 'has_many' database relationship.
has_field 'addresses' => ( type => 'Repeatable' );
has_field 'addresses.address_id' => ( type => 'PrimaryKey' );
has_field 'addresses.street';
has_field 'addresses.city';
has_field 'addresses.state';
In a form, for an array of single fields (not directly equivalent to a database relationship) use the 'contains' pseudo field name:
has_field 'tags' => ( type => 'Repeatable' );
has_field 'tags.contains' => ( type => 'Text',
apply => [ { check => ['perl', 'programming', 'linux', 'internet'],
message => 'Not a valid tag' } ]
);
or use 'contains' with single fields which are compound fields:
has_field 'addresses' => ( type => 'Repeatable' );
has_field 'addresses.contains' => ( type => '+MyAddress' );
If the MyAddress field contains fields 'address_id', 'street', 'city', and 'state', then this syntax is functionally equivalent to the
first method where the fields are declared with dots ('addresses.city');
You can pass attributes to the 'contains' field by supplying a 'contains' hashref.
has_field 'addresses' => ( type => 'Repeatable,
init_contains => { wrapper_attr => { class => ['hfh', 'repinst'] } },
);
DESCRIPTION
This class represents an array. It can either be an array of hashrefs (compound fields) or an array of single fields.
The 'contains' keyword is used for elements that do not have names because they are not hash elements.
This field node will build arrays of fields from the the parameters or an initial object, or empty fields for an empty form.
The name of the element fields will be an array index, starting with 0. Therefore the first array element can be accessed with:
$form->field('tags')->field('0')
$form->field('addresses')->field('0)->field('city')
or using the shortcut form:
$form->field('tags.0')
$form->field('addresses.0.city')
The array of elements will be in "$form->field('addresses')->fields". The subfields of the elements will be in a fields array in each
element.
foreach my $element ( $form->field('addresses')->fields )
{
foreach my $field ( $element->fields )
{
# do something
}
}
Every field that has a 'fields' array will also have an 'error_fields' array containing references to the fields that contain errors.
Complications
When new elements are created by a Repeatable field in a database form an attempt is made to re-load the Repeatable field from the
database, because otherwise the repeatable elements will not have primary keys. Although this works, if you have included other fields in
your repeatable elements that do *not* come from the database, the defaults/values must be able to be loaded in a way that works when the
form is initialized from the database item. This is only an issue if you re-present the form after the database update succeeds.
ATTRIBUTES
index
This attribute contains the next index number available to create an additional array element.
num_when_empty
This attribute (default 1) indicates how many empty fields to present in an empty form which hasn't been filled from parameters or
database rows.
num_extra
When the field results are built from an existing object (item or init_object) an additional number of repeatable elements will be
created equal to this number. Default is 0.
add_extra
When a form is submitted and the field results are built from the input parameters, it's not clear when or if an additional repeatable
element might be wanted. The method 'add_extra' will add an empty repeatable element.
$form->process( params => {....} );
$form->field('my_repeatable')->add_extra(1);
This might be useful if the form is being re-presented to the user.
AUTHOR
FormHandler Contributors - see HTML::FormHandler
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Gerda Shank.
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.14.2 2012-06-25 HTML::FormHandler::Field::Repeatable(3pm)