Sponsored Content
Top Forums Shell Programming and Scripting Merge multiple lines into a single line Post 303000112 by dwdnet on Tuesday 4th of July 2017 01:01:46 PM
Old 07-04-2017
Merge multiple lines into a single line

Hi all, I'm relatively new to scripting, I can do pretty basic things. I have a daily log file that looks like:

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 from database where table.field = value

There is a blank line between each log entry. I need to combine each log entry into one line and preferably remove the final semi-colon if there is one. I'm guessing that awk or sed could help. I've asked elsewhere, still no luck. Hopefully someone can help me out here.

Last edited by vbe; 07-04-2017 at 02:31 PM.. Reason: code tags...
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
elmalias(1)						      General Commands Manual						       elmalias(1)

NAME
elmalias - display and verify elm user and system aliases SYNOPSIS
format[alias-name-list] Remarks The former functionality of the command has been taken over by the command (see newalias(1)). DESCRIPTION
The command displays and verifies user and system aliases. The system database must have been created by the command (see newalias(1)). The user database must have been created by either the com- mand or the mail system (see elm(1)). If the same alias is in both databases, the user version is used. Missing database files are silently ignored. Each database entry can have the following fields, which are described in detail in newalias(1): alias-list A list of one or more aliases for the entry. address-list A list of one or more addresses for the entry. An address can be an alias from another entry's alias-list. comment An optional field containing information about the entry. This field is not included in outbound mail. firstname An optional field interpreted as the first name of the person or group. It is used in fullname. lastname An optional field interpreted as the last name of the person or group. It is used in fullname. fullname A combination value made up from the firstname and lastname fields, in the form: firstname lastname. recognizes three types of alias names: A database entry that has one address in address-list. assumes this address is a valid mailing address. A database entry that has two or more addresses in address-list. assumes initially that these addresses are aliases to or entries. An address in a entry or an alias in alias-name-list that is not an alias in the database. In both cases, the item is reported as both the alias name and its address. With no options or operands, displays the address-list field for each alias in the two databases. If an entry has more than one alias, the address-list field is displayed multiple times. With an alias-name-list and no options, displays the address-list field of each alias name in the list. If an alias name is not found in the databases, it is treated as without comment. Options recognizes the following options: Change the display to alias name followed by address-list field. Turn debugging on. Fully expand aliases. This option can be used only when an alias-name-list is given. If an address in a address list is an alias name, it is replaced by that alias entry. The process is recursive until the results are either or types. If a address is not an alias name, it is reported as both the alias name and the address, with type Duplicate alias names are reported only once. entries are not expanded, even if their addresses are actually aliases. Display the format string for each alias name in the file or in the alias-name-list. The following character pairs are replaced in the format by the corresponding value for each alias. The alias name. The comment field. The lastname field. The fullname value. The alias type: or The address-list field. Change the display to address-list followed by fullname, if any, in parentheses. Report an error if a name in alias-name-list does not correspond to an alias in the database. Display a message for each unknown name and exit with a nonzero status. Use the system alias database only, unless is also specified. Use the user alias database only, unless is also specified. Use a verbose output format. Change the display to alias name, followed by address-list, followed by fullname, if any, in parentheses. Use a very verbose, multiline output format with the following titles, corresponding to the format codes of the option. If a field is empty, the title is omitted. EXIT STATUS
sets the following exit status values: Normal completion. An error occurred. You may have specified: o An invalid option. o The option without an alias-name-list. o The option without a format. o The option with an unknown alias name in alias-name-list. EXAMPLES
Consider a user database that contains the following entries: Since and do not refer to alias entries, they are typed as with no options or operands produces the following output. produces the alias names, address, and full name, as follows: To expand a set of aliases and format them with field titles, use the and options, as in the following command: producing: AUTHOR
was developed by HP. FILES
User alias database data table User alias database directory table User alias database hash table User alias source text System alias database data table System alias database directory table System alias database hash table System alias source text SEE ALSO
elm(1), newalias(1). elmalias(1)
All times are GMT -4. The time now is 02:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy