05-19-2011
merge lines within a file that start with a similar pattern
Hello! i have a text file.. which contains the data as follows
Quote:
int a,b,c
int d
float e,f,g
float h,i
float j
char m,p
char q,r
i want to merge the declarations lines pertaining to one datatype in to a single line as follows
Quote:
int a,b,c,d
float e,f,g,h,i,j
char m,p,q,r
i've searched the forum for help.. but couldn't find much help.. how can i do this??
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a file like this.
please notice that ./usr/orders1/order_new_2627 appears more than once, thus needs to be merged.
I would like to merge the lines where the first column match
so the output should be like this:
Please help (2 Replies)
Discussion started by: rakeshou
2 Replies
2. Shell Programming and Scripting
Hello,
I have searched forum trying to find a solution to my problem, but could not find anything or I did not understand the examples....
I should say, I am very inexperienced with text processing.
I have a text file with approx 60k lines in it.
I need to merge lines based on the number... (8 Replies)
Discussion started by: Bertik
8 Replies
3. Shell Programming and Scripting
I have one comma separated file (a.txt) with two or more records all matching except for the last column.
I would like to merge all matching lines into one and consolidate the last column, separated by ":". Does anyone know of a way to do this easily?
I've searched the forum but most talked... (6 Replies)
Discussion started by: giannicello
6 Replies
4. Shell Programming and Scripting
Hi people...
I normally find with out any problem the solutions I need just by searching. But for this I'm not having any joy or jsut failing to adapt what I'ev found to work.
I have applciation report that doesn't allow for manipulation at creation so I want to do some post modifcation... (2 Replies)
Discussion started by: nhatch
2 Replies
5. Shell Programming and Scripting
Input file 1:
A1BG
A1BG
A1BG
A1CF
A1CF
BCAS
BCAS
A2LD1
A2M
A2M
HAT
.
.
Input file 2:
A1BG All
A1CF TEMP (5 Replies)
Discussion started by: perl_beginner
5 Replies
6. Shell Programming and Scripting
I am trying to Join all the lines matching similar pattern.
Example ;
I wanted to join all the lines which has sam to a single line.
In next line, i wanted to have all the lines with jones to a single line....etc
> cat sample.txt
sam 2012/11/23
sam 2012/12/5
sam 2012/12/5
jones... (2 Replies)
Discussion started by: evrurs
2 Replies
7. Shell Programming and Scripting
Hi,
I have a requirement to merge multiple lines based on search pattern. The search criteria is : it will search for CONSTRAINT and when it found CONSTRAINT, it will merge all lines to 1 line till it founds blank line.
For Example:
CREATE TABLE "AMS_DISTRIBUTOR_XREF"
(
"SOURCE"... (5 Replies)
Discussion started by: satyaatcgi
5 Replies
8. Shell Programming and Scripting
Hi all,
I have been searching all over Google but I am unable to find a solution for a particular result that I am trying to achieve.
Consider the following input:
1
2
3
4
5
B4Srt1--Variable-0000
B4Srt2--Variable-1111
Srt
6
7
8
9
10
End (3 Replies)
Discussion started by: y2jacky
3 Replies
9. Shell Programming and Scripting
Hello,
I've been working on a bash script to parse through firewall logs (cisco). I'm nearing the end and have a dilemma.
My data looks as such (actual data is several gigs worth of logs - without the headers):
sourceIP destinationIP destinationProtocol destinationPort
1.1.1.1 2.2.2.2 ... (2 Replies)
Discussion started by: umang2382
2 Replies
10. Shell Programming and Scripting
Hi Folks,
I have a big file that looks like below
==========
kjhjl
kjlklkkhcgflj
fgf
==========
xsww23edc
ccdde3rfv
ceerfcc
vff4
==========
zaq12wsx
xsw23edc
==========
========== (3 Replies)
Discussion started by: jayadanabalan
3 Replies
LEARN ABOUT PHP
cairo_clip_extents
CAIRO_CLIP_EXTENTS(3) 1 CAIRO_CLIP_EXTENTS(3)
CairoContext::clipExtents - Computes the area inside the current clip
Object oriented style (method):
SYNOPSIS
public array CairoContext::clipExtents (void )
DESCRIPTION
Procedural style:
array cairo_clip_extents (CairoContext $context)
Computes a bounding box in user coordinates covering the area inside the current clip.
PARAMETERS
o $context
- A valid CairoContext object
RETURN VALUES
An array containing the (float)x1, (float)y1, (float)x2, (float)y2, coordinates covering the area inside the current clip
EXAMPLES
Example #1
Object oriented style
<?php
$surface = new CairoImageSurface(CairoFormat::ARGB32, 50, 50);
$context = new CairoContext($surface);
var_dump($context->clipExtents());
?>
The above example will output something similar to:
array(4) {
[0]=>
float(0)
[1]=>
float(0)
[2]=>
float(50)
[3]=>
float(50)
}
Example #2
Procedural style
<?php
$surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 50, 50);
$context = cairo_create($surface);
var_dump(cairo_clip_extents($context));
?>
The above example will output something similar to:
array(4) {
[0]=>
float(0)
[1]=>
float(0)
[2]=>
float(50)
[3]=>
float(50)
}
SEE ALSO
CairoContext::clip.
PHP Documentation Group CAIRO_CLIP_EXTENTS(3)