Merge multiple lines into a single line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Merge multiple lines into a single line
# 22  
Old 07-11-2017
Quote:
Originally Posted by Don Cragun
We haven't seen enough information to determine whether or not there are <newline> (or <linefeed>) characters in the input file. Using RS= in awk to set the record separator to sequences of blank lines will not treat a line containing a <carriage-return> as a blank line. So, awk won't find any record separators in a DOS input file. (And, if you remove the <carriage-return> characters in the code that will happen AFTER the record separator search has already occurred.)

I would start by trying:
Code:
awk '
function p() {
    if(d) {
        sub(/;$/, "", o)
        print o
        o = ""
        d = 0
    }
}
{    sub(/\r/, "")
}
!NF {    p()
    next
}
{    $1 = $1
    o = o (o == "" ? "" : " ") $0
    d = 1
}
END {    p()
}' file

If that doesn't work, please show us the output from:
Code:
od -bc file

where file is the name of your input file.
I wonder if
Code:
    o = o (o == "" ? "" : " ") $0

is always correct.
We have a control variable d so let's use it. Becomes simpler and maybe fixes a problem, too.?
Code:
        o = o (d ? " " : "") $0

This User Gave Thanks to MadeInGermany For This Post:
# 23  
Old 07-11-2017
Quote:
Originally Posted by dwdnet
Manually editing would be very time consuming so I'll attempt to explain using the example below. Running your initial function helped quite a bit and re-formated the majority of records. There were some fields, within the record, (statement text=) that still were broken up with a LF.

Sample Input
Code:
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, 
table.field, table.field, from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field from database where table.field = value

Sample Output
Code:
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, table.field, from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field from database where table.field = value
timestamp=2017-06-28-01.01.35.080576; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI
timestamp=2017-06-28-01.01.36.096486; event status=0; userid=user1; authid=user1; application id=10.10.10.10.11111.12345678901; application name=GUI; statement text=SELECT table.field, table.field, table.field from database where table.field = value

Hi dwdnet,
Instead of showing us the output you get from running the awk script provided in post #12 and labeling it "Sample Input", please show us the input that was given to that awk script. We need to see the input that is causing that code to fail. Seeing the output it produces without seeing the corresponding input leaves us guessing at what might be the problem!

Quote:
Originally Posted by MadeInGermany
I wonder if
Code:
    o = o (o == "" ? "" : " ") $0

is always correct.
We have a control variable d so let's use it. Becomes simpler and maybe fixes a problem, too.?
Code:
        o = o (d ? " " : "") $0

Hi MadeInGermany,
Your suggested change makes the code 6 characters shorter, but it doesn't alter the underlying logic. The code that sets d to 1 only runs when NF is non-zero (so o can't be set to an empty string in this case) and the code that sets d to 0 also sets o to an empty string.
This User Gave Thanks to Don Cragun For This Post:
# 24  
Old 07-12-2017
Thanks for making me go back to the original sample, I looked at a few of the more complex database statements and there were blank lines in some of the statement text= fields. Here's an example of the sample input:
Code:
timestamp=2017-06-23-15.26.59.242142;
  event status=0;
  userid=user1;
  authid=user1;
  application id=10.10.10.10.56150.170623204912;
  application name=application;
  statement text=xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
      xxxxx xxxxx
             -1                  xxxxx  xxxxx
            ,-1                  xxxxx  xxxxx
            ,-1                  xxxxx  xxxxx
            ,xxxxx               xxxxx xxxxx
            ,xxxxx               xxxxx  xxxxx
            ,xxxxx               xxxxx  xxxxx
            ,xxxxx               xxxxx  xxxxx
            ,xxxxx               xxxxx  xxxxx
            ,xxxxx 
               xxxxx xxxxx = 1 xxxxx :xxxxx  :xxxxx  = 'N' xxxxx
                 xxxxx(xxxxx,-1)
               xxxxx
                 -1
             xxxxx                 xxxxx  xxxxx                
            ,xxxxx 
               xxxxx xxxxx = 1 xxxxx :xxxxx  :xxxxx  = 'N' xxxxx
                 xxxxx(xxxxx,-1)
               xxxxx
                 -1 
             xxxxx                 xxxxx  xxxxx
            ,xxxxx
               xxxxx xxxxx = 1 xxxxx :xxxxx  :xxxxx  = 'N' xxxxx
                 xxxxx(xxxxx,-1)
               xxxxx
                 -1
             xxxxx                 xxxxx xxxxx
            ,xxxxx
               xxxxx xxxxx = 1 xxxxx :xxxxx  :xxxxx  = 'N' xxxxx
                 xxxxx(xxxxx,-1)
               xxxxx
                 -1
             xxxxx                 xxxxx xxxxx
            ,-1                  xxxxx  xxxxx
                              
            ,xxxxx                 xxxxx xxxxx
        xxxxx xxxxx  xxxxx xxxxx    xx xxxxx  xxxxx   = xxxxx   
                          xxxxx xxxxx xxxxx     x xxxxx xxxxx   =  xxxxx   
                          xxxxx  xxxxx xxxxx    xx xxxxx xxxxx   =  xxxxx   
                          xxxxx xxxxx xxxxx     x xxxxx  xxxxx   =  xxxxx  
                          xxxxx  xxxxx (xxxxx xxxxx, xxxxx, xxxxx xxxxx :xxxxx  :xxxxx  = x xxxxx xxxxx xxxxx (x,x) xxxxx x xxxxx xxxxx xxxxx xxxxx xxxxx, xxxxx xxxxx 
                          (xxxxx xxxxx xxxxx xxxxx xxxxx) xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx <= x 
                          xxxxx (:xxxxx  :xxxxx  = x xxxxx xxxxx <= x)) xxxx xxxxx xxxxx = xxxx.xxxxx xxxxx xxxx.xxxxx = x
                          xxxxx  xxxxx xxxxx    xx xxxxx xxxxx = xxxxx
                          xxxxx  xxxxx xxxxx    xx xxxxx  xxxxx = xxxxx 
                          xxxxx xxxxx xxxxx     x xxxxx  xxxxx = xxxxx

       xxxxx ( (xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx = xxxxx)
               xxxxx
               (xxxxx xxxxx xxxxx xxxxx xxxxx)
             )
         xxxxx ((:xxxxx  :xxxxx      xxxxx xxxxx :xxxxx  :xxxxx      = -1 ) xxxxx ((:xxxxx  :xxxxx      xxxxx xxxxx :xxxxx  :xxxxx      <> -1 ) xxxxx (xxxxx      = :xxxxx  :xxxxx  xxxxx xxxxx xxxxx) )               )
         xxxxx ((:xxxxx  :xxxxx      xxxxx xxxxx :xxxxx  :xxxxx      = -1 ) xxxxx ((:xxxxx  :xxxxx      xxxxx xxxxx :xxxxx  :xxxxx      <> -1 ) xxxxx xxxxx       = :xxxxx  :xxxxx  xxxxx xxxxx = :xxxxx  :xxxxx )            )
         xxxxx ((:xxxxx  :xxxxx    xxxxx xxxxx :xxxxx  :xxxxx    = -1 ) xxxxx ((:xxxxx  :xxxxx    xxxxx xxxxx :xxxxx  :xxxxx    <> -1 ) xxxxx  xxxxx = :xxxxx  :xxxxx )                                   )
         xxxxx (xxxxx xxxxx xxxxx xxxxx = 'Y')
         xxxxx xxxxx = 'Y'
         xxxxx xxxxx = 'Y'
       xxxxx xxxxx,xxxxx,xxxxx;
  
timestamp=2017-06-23-15.26.59.244718;
  event status=0;
  userid=user1;
  authid=user1;
  application id=10.10.10.10.56150.170623204912;
  application name=application;
  
timestamp=2017-06-23-15.27.29.623890;
  event status=0;
  userid=user1;
  authid=user1;
  application id=10.10.10.10.56150.170623204912;
  application name=application;
  statement text=xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
  
timestamp=2017-06-23-15.27.29.625418;
  event status=0;
  userid=user1;
  authid=user1;
  application id=10.10.10.10.56150.170623204912;
  application name=application;
  
timestamp=2017-06-23-15.28.00.043829;
  event status=0;
  userid=user1;
  authid=user1;
  application id=10.10.10.10.56150.170623204912;
  application name=application;
  statement text=xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
      xxxxx xxxxx
            ,xxxxx               xxxxx  xxxxx
            ,xxxxx               xxxxx  xxxxx
            ,xxxxx
               xxxxx xxxxx = 1 xxxxx :xxxxx  :xxxxx  = 'N' xxxxx
                 xxxxx(xxxxx.xxxxx,-1)
               xxxxx
                 -1
             xxxxx                            xxxxx xxxxx
            ,-1                             xxxxx  xxxxx
                              

       xxxxx ( (xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx = xxxxx)
               xxxxx
               (xxxxx xxxxx xxxxx xxxxx xxxxx)
             )
         xxxxx ((:xxxxx  :xxxxx      xxxxx xxxxx :xxxxx  :xxxxx      = -1 ) xxxxx ((:xxxxx  :xxxxx      xxxxx xxxxx :xxxxx  :xxxxx      <> -1 )
         xxxxx (xxxxx       = :xxxxx  :xxxxx  xxxxx xxxxx xxxxx) )               )
       xxxxx xxxxx,xxxxx,xxxxx;
  
timestamp=2017-06-23-15.28.00.045415;
  event status=0;
  userid=user1;
  authid=user1;
  application id=10.10.10.10.56150.170623204912;
  application name=application;

# 25  
Old 07-13-2017
How far would - except for the final semicolon - bring you
Code:
awk '/^timestamp/  && NR > 1 {printf RS RS} 1' ORS=" " file

This User Gave Thanks to RudiC For This Post:
# 26  
Old 07-13-2017
You could also try:
Code:
awk '
function p() {
        if(d) {
                print ""
                d = s = 0
        }
}
{       sub(/\r/, "")
} 
/^timestamp=/ {
        p()
} 
NF {    $1 = $1
        ns = sub(/;$/, "")
        printf("%s%s%s", (s ? ";" : ""), (d ? " " : ""), $0)
        s = ns
        d = 1
}              
END {   p()      
}' file

which gets rid of the DOS line terminator <carriage-return> characters, the semicolons at the ends of each output record that contains one, and strips out extraneous whitespace. With the sample input you provided in post #24, the above code produces the output:
Code:
timestamp=2017-06-23-15.26.59.242142; event status=0; userid=user1; authid=user1; application id=10.10.10.10.56150.170623204912; application name=application; statement text=xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx -1 xxxxx xxxxx ,-1 xxxxx xxxxx ,-1 xxxxx xxxxx ,xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx = 1 xxxxx :xxxxx :xxxxx = 'N' xxxxx xxxxx(xxxxx,-1) xxxxx -1 xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx = 1 xxxxx :xxxxx :xxxxx = 'N' xxxxx xxxxx(xxxxx,-1) xxxxx -1 xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx = 1 xxxxx :xxxxx :xxxxx = 'N' xxxxx xxxxx(xxxxx,-1) xxxxx -1 xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx = 1 xxxxx :xxxxx :xxxxx = 'N' xxxxx xxxxx(xxxxx,-1) xxxxx -1 xxxxx xxxxx xxxxx ,-1 xxxxx xxxxx ,xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xx xxxxx xxxxx = xxxxx xxxxx xxxxx xxxxx x xxxxx xxxxx = xxxxx xxxxx xxxxx xxxxx xx xxxxx xxxxx = xxxxx xxxxx xxxxx xxxxx x xxxxx xxxxx = xxxxx xxxxx xxxxx (xxxxx xxxxx, xxxxx, xxxxx xxxxx :xxxxx :xxxxx = x xxxxx xxxxx xxxxx (x,x) xxxxx x xxxxx xxxxx xxxxx xxxxx xxxxx, xxxxx xxxxx (xxxxx xxxxx xxxxx xxxxx xxxxx) xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx <= x xxxxx (:xxxxx :xxxxx = x xxxxx xxxxx <= x)) xxxx xxxxx xxxxx = xxxx.xxxxx xxxxx xxxx.xxxxx = x xxxxx xxxxx xxxxx xx xxxxx xxxxx = xxxxx xxxxx xxxxx xxxxx xx xxxxx xxxxx = xxxxx xxxxx xxxxx xxxxx x xxxxx xxxxx = xxxxx xxxxx ( (xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx = xxxxx) xxxxx (xxxxx xxxxx xxxxx xxxxx xxxxx) ) xxxxx ((:xxxxx :xxxxx xxxxx xxxxx :xxxxx :xxxxx = -1 ) xxxxx ((:xxxxx :xxxxx xxxxx xxxxx :xxxxx :xxxxx <> -1 ) xxxxx (xxxxx = :xxxxx :xxxxx xxxxx xxxxx xxxxx) ) ) xxxxx ((:xxxxx :xxxxx xxxxx xxxxx :xxxxx :xxxxx = -1 ) xxxxx ((:xxxxx :xxxxx xxxxx xxxxx :xxxxx :xxxxx <> -1 ) xxxxx xxxxx = :xxxxx :xxxxx xxxxx xxxxx = :xxxxx :xxxxx ) ) xxxxx ((:xxxxx :xxxxx xxxxx xxxxx :xxxxx :xxxxx = -1 ) xxxxx ((:xxxxx :xxxxx xxxxx xxxxx :xxxxx :xxxxx <> -1 ) xxxxx xxxxx = :xxxxx :xxxxx ) ) xxxxx (xxxxx xxxxx xxxxx xxxxx = 'Y') xxxxx xxxxx = 'Y' xxxxx xxxxx = 'Y' xxxxx xxxxx,xxxxx,xxxxx
timestamp=2017-06-23-15.26.59.244718; event status=0; userid=user1; authid=user1; application id=10.10.10.10.56150.170623204912; application name=application
timestamp=2017-06-23-15.27.29.623890; event status=0; userid=user1; authid=user1; application id=10.10.10.10.56150.170623204912; application name=application; statement text=xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
timestamp=2017-06-23-15.27.29.625418; event status=0; userid=user1; authid=user1; application id=10.10.10.10.56150.170623204912; application name=application
timestamp=2017-06-23-15.28.00.043829; event status=0; userid=user1; authid=user1; application id=10.10.10.10.56150.170623204912; application name=application; statement text=xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx ,xxxxx xxxxx xxxxx = 1 xxxxx :xxxxx :xxxxx = 'N' xxxxx xxxxx(xxxxx.xxxxx,-1) xxxxx -1 xxxxx xxxxx xxxxx ,-1 xxxxx xxxxx xxxxx ( (xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx = xxxxx) xxxxx (xxxxx xxxxx xxxxx xxxxx xxxxx) ) xxxxx ((:xxxxx :xxxxx xxxxx xxxxx :xxxxx :xxxxx = -1 ) xxxxx ((:xxxxx :xxxxx xxxxx xxxxx :xxxxx :xxxxx <> -1 ) xxxxx (xxxxx = :xxxxx :xxxxx xxxxx xxxxx xxxxx) ) ) xxxxx xxxxx,xxxxx,xxxxx
timestamp=2017-06-23-15.28.00.045415; event status=0; userid=user1; authid=user1; application id=10.10.10.10.56150.170623204912; application name=application

This User Gave Thanks to Don Cragun For This Post:
# 27  
Old 07-13-2017
Thanks everyone, Don's code above did the trick. I really appreciate it, this will help immensely and save me an enormous amount of time.
# 28  
Old 07-17-2017
Hi Don,
I'm trying to figure out how your code works. If you wouldn't mind could you explain it for me please? I'd like to learn how it worked. Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Merge multi-lines into one single line using shell script or Linux command

Hi, Can anyone help me for merge the following multi-line log which beginning with a " and line ending with ": into one line. *****Original Log***** 087;2008-12-06;084403;"mc;;SYHLR6AP1D\LNZW;AD-703;1;12475;SYHLR6AP1B;1.1.1.1;0000000062;HGPDI:MSISDN=12345678,APNID=1,EQOSID=365;... (3 Replies)
Discussion started by: rajeshlinux2010
3 Replies

2. UNIX for Dummies Questions & Answers

Need help combining txt files w/ multiple lines into csv single cell - also need data merge

:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux. I am working in Linux terminal. I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies

3. Shell Programming and Scripting

Merge multiple lines in one line

Hi guys, So i have a input file with several sequences aligned (fasta) >NC_005930 241 bp MNMINIFIINNIFDQFIPVKLSIFSLTSVGSIIA LSWVWINTKTHWAISRSNTP-SLLLNSL WTLLITNL-NEKTNPWAPWLFSLFLLCFSFNIMSLI-PYTF-SQ TSHLSFTFGLSLPIWIMVNIAGFKNNWKKKISHLLPQGTPIYLVPVMII IETISLFIQPLTLGFRLGANLLAGHLLIFLCSCTIWE... (6 Replies)
Discussion started by: andreia
6 Replies

4. Shell Programming and Scripting

Merge multiple lines to one line when line starts with and ends with

example: comment Now_TB.table column errac is for error messages 1 - first 2 - second 3 -third ; in this example I need to be able to grab the comment as first word and ; as the last word and it might span a few lines. I need it to be put all in one line without line breaks so I can... (4 Replies)
Discussion started by: wambli
4 Replies

5. Shell Programming and Scripting

Multiple lines in a single column to be merged as a single line for a record

Hi, I have a requirement with, No~Dt~Notes 1~2011/08/1~"aaa bbb ccc ddd eee fff ggg hhh" Single column alone got splitted into multiple lines. I require the output as No~Dt~Notes 1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh" mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies

6. UNIX for Advanced & Expert Users

Merge a group of lines into single line

Hi Everybody, Below are the contents of the a text file .., SN = 8 MSI = 405027002277133 IKVALUE = DE6AA6A11D42B69DF6398D44B17BC6F2 K4SNO = 2 CARDTYPE = SIM ALG = COMP128_3 SN = 8 MSI = 405027002546734 IKVALUE = 1D9F8BAA73973D8FBF8CBFB01436D822 K4SNO = 2 CARDTYPE = SIM ALG =... (8 Replies)
Discussion started by: prasanth_babu
8 Replies

7. Shell Programming and Scripting

merge lines into single line based on symbol \t

The symbols are \t and \t\t (note: not tab) If the line starts with \t merge them into a single line upto symbol \t\t \t\t to end and start new line I able to join in a single line but not ending at \t\t and I completely confused help would be appreciated:b::D Input \ta tab XXXXXXXXXX \te... (5 Replies)
Discussion started by: repinementer
5 Replies

8. Shell Programming and Scripting

Help on Merge multi-lines into one single line

Hello, Can anyone let me know how to use Perl script to Merge following multi-lines into one single line... ***** Multi-line***** FILE_Write root OK Tue Jul 01 00:00:00 2008 cl_get_path file descriptor = 1 FILE_Write root OK ... (5 Replies)
Discussion started by: happyday
5 Replies

9. Shell Programming and Scripting

Merge multi-lines into one single line

Hi, Can anyone help me for merge the following multi-line log which beginning with a number and time: into one line. For each line need to delete the return and add a space. Please see the red color line. *****Original Log*****... (4 Replies)
Discussion started by: happyday
4 Replies

10. Shell Programming and Scripting

Removing end of line to merge multiple lines

I'm sure this will be an easy question for you experts out there, but I have been searching the forum and working on this for a couple hours now and can't get it right. I have a very messy data file that I am trying to tidy up - one of the issues is some records are split into multiple lines: ... (4 Replies)
Discussion started by: tink
4 Replies
Login or Register to Ask a Question