Sponsored Content
Top Forums Shell Programming and Scripting Concatenating the lines of a data Post 302594906 by aravindj80 on Wednesday 1st of February 2012 12:43:57 PM
Old 02-01-2012
Concatenating the lines of a data

I have a data of 1 lac lines with the following format

Code:
abcde,1,2,3,4,
,ee
,ff
,gg
,hh
,mm
abcde,3,4,5,6,
,we
,qw
,as
,zx
,cf
abcde,1,5,6,7,
,dd
,aa
,er
....
....
....
abcde,1,5,4,3,
,kk
,gh

abcde is there in all record , it is starting word and below lines are sub records

I would like to concatenate to make the output like

Code:
abcde,1,2,3,4,ee,ff,gg,hh,mm
abcde,3,4,5,6,we,qw,as,zx,cf
.
.
.
.
abcde,1,5,4,3,kk,gh

Please help with a script either in Unix Shell or Perl

Last edited by methyl; 02-01-2012 at 02:13 PM.. Reason: pelase use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Concatenating lines and formatting.

Hi, I have a html file which is unformatted and need to concatenate the lines between each "table" statement in order to run an awk statement on it. Here is the example of the raw file: <table border="0" cellspacing="0" cellpadding="0" class="playerDetails"> def ... (3 Replies)
Discussion started by: Tonka52
3 Replies

2. Shell Programming and Scripting

Concatenating the two lines in a file

hi My requirement is i have a file with some records like this file name ::xyz a=1 b=100,200 ,300,400 ,500,600 c=700,800 d=900 i want to change my file a=1 b=100,200,300,400 c=700,800 d=900 if record starts with " , " that line should fallows the previous line.please give... (6 Replies)
Discussion started by: srivsn
6 Replies

3. Shell Programming and Scripting

concatenating selected lines of multiple files

Hi, I would like a shell script that reads all files in a directory and concatenate them. It is not a simple concatenation. The first few lines of the files should not be included. The lines to be included are the lines from where 'START HERE' appears up to the end of the file. For example, I... (4 Replies)
Discussion started by: laiko
4 Replies

4. Shell Programming and Scripting

Concatenating the lines with different pattern

Hi, I have put a similar question in one of the other threads through which I got the solution shown below but I have some more condition to add to it, hence have further queries on it. I appologies if I should be putting this with the old thread. I have a file which perform a grep on the... (1 Reply)
Discussion started by: simi28
1 Replies

5. Shell Programming and Scripting

awk: switching lines and concatenating lines?

Hello, I have only recently begun with awk and need to write this: I have an input consisting of a couple of letters, a space and a number followed by various other characters: fiRcQ 9( ) klsRo 9( ) pause fiRcQ 9( ) pause klsRo continue 1 aPLnJ 62( ) fiRcQ continue 5 ... and so on I... (7 Replies)
Discussion started by: Borghal
7 Replies

6. Shell Programming and Scripting

Concatenating lines in bash

Hi, I'm attempting to join two lines in a file which are separated by a line break. The file contents are shown below: event_id=0 id=0_20100505210853 IFOconfig=HLV template=TaylorF2 Nlive=1000.0 Nruns=1.0 NIFO=3... (7 Replies)
Discussion started by: Supersymmetric
7 Replies

7. Shell Programming and Scripting

Concatenating lines ending with '+' using awk

Hi, I have an ASCII text file where some of the lines are ending with '+' character. I have to concatenate the next successive line with those lines having the trailing '+' char by removing that char. The below awk code has some problems to do this task: awk '{while(sub(/\+$/,"")) {... (12 Replies)
Discussion started by: royalibrahim
12 Replies

8. Shell Programming and Scripting

Concatenating more than two lines into one based on some columns

Hi, I need to concatenate some lines in a file based on the First 4 coloumns of a file .. (For Eg.) Consider a file ... I,01,000002,0666,00000.00,000,00,000,000, ,0 I,01,000002,0667,00000.00,000,00,000,000, ,0 I,01,000002,0666,00056.10 I,01,000002,0667,00056.10 I,01,000002,0666,00001... (6 Replies)
Discussion started by: Sri3001
6 Replies

9. Shell Programming and Scripting

Concatenating 2 lines from 2 files having matching strings

Hello All Unix Users, I am still new to Unix, however I am eager to learn it.. I have 2 files, some lines have some matching substrings, I would like to concatenate these lines into one lines, leaving other untouched. Here below is an example for that.. File 1 (fasta file): >292183... (6 Replies)
Discussion started by: Mohamed EL Hadi
6 Replies

10. UNIX for Dummies Questions & Answers

Problems concatenating data using UNIX?

Hello, Can somebody help me to solve this inconsistent data issue. I have a pipe delimiter file and one of the column is a comment. I am trying to concatenate into one single sentence. For instance, I have a file actually with 2 records but the way it considers the first record is as different... (3 Replies)
Discussion started by: brialp
3 Replies
DR_CDRIP(1)							       Draai							       DR_CDRIP(1)

NAME
dr_cdrip - rip audio cd's to ogg SYNOPSIS
dr_cdrip [args] < id3-tag-file DESCIPTION
dr_cdrip sets up a cdparanoia(1) - oggenc(1) pipe for each track on your audio cd, so that the audio on your cd will be stored as .ogg files on your harddisk. args will get passed to each songs' oggenc(1) invocation. id3-tag-file could look like this: Jaffa - Star 67 Think of one - Den Antwaarpse Shabi Klute - Angry Woman Electrotwist - The Smurfer Evil characters are discarded from the file, we don't want them to appear in filenames. If a line lacks a ' - ', the line is assumed to be a title. Defauls setting of oggenc(1)'s --quality level is 7, override by setting the CDRIP_QUALITY environment variable. Note: mp3's id3 tags seem to be called "comments" in the .ogg world. EXAMPLE
dj@gelfand ~$ export CDRIP_QUALITY=9 dj@gelfand /h.../The_New_York_Contemporary_Five$ dr_cdrip -l "The New York Contemporary Five" -a "Archie Shepp" -c "description=Don Cherry: crnt, Archie Shepp: ts, Don Moore: b, JC Moses:d" -c "genre=Jazz" -c "date=1963" -c "location=Copenhagen" -c "copyright=1991 Storyville Records" -c "license=All Rights Reserved" -c "organization=Storyville" -c "contact=http://www.storyville-records.com/" -c "diskid=bd10c70d" < /tmp/songlist See DISCID HOWTO on http://freedb.org/modules.php?name=Sections&sop=viewarticle&artid=6 for info on disk id. Beware! A diskid comment is _not_ mentioned in the xiph.org suggestions! (oggenc's -t will be used by dr_cdrip. -a might be.) supported extra comments are (see ogg123.c) VERSION=, TRACKNUMBER=, ISRC= ARTIST is -a, ALBUM is -l TITLE is -t. VERSION is e.g. 'Biosphere Foo Mix'. Multipe ARTIST tags can occur; this use is encouraged if applicable. -c foo will be displayed by ogg123 as 'Comment: foo'. Run something like: cdcd tracks | sed 's/^.*] *//' | sed 's/ $//' to extract a songlist from a cddb database. BUGS
The format of the songinfo input file is non-standard. Support for cddb is lacking. SEE ALSO
http://xiph.org/ogg/vorbis/doc/v-comment.html abcde - A Better CD Encoder at http://www.hispalinux.es/~data/abcde.php VERSION, SOURCE This file is maintained at http://git.mdcc.cx/draai HISTORY
First version written 2001-01-09. Last maintenance, as of 2007-08-22, done at 2005-12-14. COPYRIGHT
Copyright: AX 2001-2005 Joost van Baal This program is in the public domain. AUTHOR
Joost van Baal <spamhere@mdcc.cx> draai 20100511 2009-12-16 DR_CDRIP(1)
All times are GMT -4. The time now is 12:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy