I've looked at the join command which is able to perform what I need on two rows with a common field, however if I have more than two rows I need to join all of them.
Thus I have one file with multiple rows to be joined on an index number:
I need this:
where the repeated index number may have an arbitrary number of rtext's to be pivoted to columns for that index number. The number suffixes on rtext are only there for clarity.
I've considered using uniq to extracting the repeated text and using the results from that to remove that specific line in awk, then just reiterate this process in a script and use 'join', but I'm convinced there is a complete, easier solution.
updates: I have progressed to a solution with gawk... now I am having a problem with losing the order of rows as columns.
Last edited by crimper; 12-14-2008 at 04:20 AM..
Reason: progress updates
Is it possible to do a join on multiple fields of two files? I am trying to do something like join -t, -1 2,3 -2 2,3 -o 2.1,2.2,2.3,1.3 filea fileb
I want the join to be on columns 2 and 3 of filea and columns 2 and 3 of fileb.
What is hapenning is that the second file that I want to do the join... (1 Reply)
Hi,
I have data with broken lines:
Sample data:
"12"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:10:50"
"16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"
2453748"|"08:15:50"
"16"|"25"|"a"|"b"|"
c"|"d"|"e"|"f"|"2453748"|"08:19:50"
"16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:19:50"
In the... (5 Replies)
Hi guys,
anyone know how can i join multiples lines using sed till the end of a file and output to another file in a single line?
The end of each line will be replaced with a special char "#".
I am using the below SED command, however it seems to remove the last 2 lines. Also not all lines... (12 Replies)
Hi, I need help with the join command
I have 2 files that I want to join on multiple fields.
I want to return all records from file 1
I also want empty fields in my joined file if there isn't a match in file 2
I have already sorted them so I know they are in the same order.
file1 ... (0 Replies)
Hi
I have a source file ( written i C ) where a funtion call is spread over multiple lines, for example :
func(
a,
b,
c
);
I want this to be joined into one single line :
func(a,b,c);
How can this be done with awk and sed ?
Regards. Hench (2 Replies)
Hi
I have a file like
1 2
1 2 3
1 5 6
11 12
10 2
7 5
17 12
I would like to have an output as
1 2 3 5 6 10 7
11 12 17
any help would be highly appreciated
Thanks (4 Replies)
I have an input file like this...
All iI want to do is If the lines are identical except for the last field i want to merge them into single line
input_file
I feel something is nothing
I feel something is everything
apple mango banana
apple mango grapes
I want to get output like this:... (3 Replies)
Hello all,
I want to join 2 tabbed files on the first 2 fields, and filling the missing values with 0. The 3rd column in each file is constant for the entire file.
file1
12658699 ST5 XX2720 0 1 0 1
53039541 ST5 XX2720 1 0 1.5 1
file2 ... (6 Replies)
Hi Guys,
Could you please advise how to join multiple details lines into single row, with HEADER 1 as the record separator and comma(,) as the field separator.
Input:
HEADER 1, HEADER 2, HEADER 3,
11,22,33,
COLUMN1,COLUMN2,COLUMN3,
AA1, BB1, CC1,
END: ABC
HEADER 1, HEADER 2,... (3 Replies)
Discussion started by: budz26
3 Replies
LEARN ABOUT DEBIAN
html::formfu::deflator::compoundsplit
HTML::FormFu::Deflator::CompoundSplit(3pm) User Contributed Perl Documentation HTML::FormFu::Deflator::CompoundSplit(3pm)NAME
HTML::FormFu::Deflator::CompoundSplit - CompoundSplit deflator
SYNOPSIS ---
element:
- type: Multi
name: address
elements:
- name: number
- name: street
deflator:
- type: CompoundSplit
# set the default
$form->get_field('address')->default( $address );
DESCRIPTION
Deflator to allow you to set several field's values at once.
For use with a HTML::FormFu::Element::Multi group of fields.
A default value passed to the Multi field will be split according to the "split" setting, and its resulting parts passed to its child
elements.
METHODS
split
Arguments: $regex
Default Value: "qr/ +/"
Regex used to split the default value. Defaults to a regex matching 1 or more space characters.
join
Arguments: $string
Default Value: ' '
If spliting the value results in more parts than there are fields, any extra parts are joined again to form the value for the last field.
The value of "join" is used to join these values.
Defaults to a single space.
For example, if the Multi element contains fields "number" and "name", and is given the value "10 Downing Street"; when split this results
in 3 parts: 10, "Downing" and "Street". In this case, the 1st part, 10 is assigned to the first field, and the 2nd and 3rd parts are re-
joined with a space to give the single value "Downing Street", which is assigned to the 2nd field.
field_order
Arguments: @order
If the parts from the split value should be assigned to the fields in a different order, you must provide an arrayref containing the names,
in the order they should be assigned to.
---
element:
- type: Multi
name: address
elements:
- name: street
- name: number
deflator:
- type: CompoundSplit
field_order:
- number
- street
AUTHOR
Carl Franks
LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-01-23 HTML::FormFu::Deflator::CompoundSplit(3pm)