Sponsored Content
Top Forums Shell Programming and Scripting Concatenating multiple lines to one line if match pattern Post 302161262 by phixsius on Thursday 24th of January 2008 05:23:17 AM
Old 01-24-2008
Concatenating multiple lines to one line if match pattern

Hi all,

I've been working on a script which I have hit a road block now. I have written a script using sed to extract the below data and pumped into another file:

Severity............: MAJORWARNING
Summary:
System temperature is out of normal range.
Severity............: MAJORWARNING
Summary:
Adapter at hardware path 0/4/1/0 : Received an interrupt indicating and
Elastic Store Error Storm
Severity............: MAJORWARNING
Summary:
Adapter at hardware path 0/3/1/0 : Received an interrupt indicating and
Elastic Store Error Storm
Severity............: MAJORWARNING
Summary:
System temperature is out of normal range.

I want to format it to look like this:
"Severity:.......... Summary:........"
"Severity:.......... Summary:........"
"Severity:.......... Summary:........"
"Severity:.......... Summary:........"

so that each ocurance will be in one line

Any ideas? Hope someone can help me quickly.

Thanks
phixsius.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Printing Multiple Lines after pattern match

Hello People, Need some assistance/guidance. OUTLINE: Two files (File1 and File2) File1 has some ids such as 009463_3922_1827 897654_8764_5432 File2 has things along the lines of: Query= 009463_3922_1827 length=252 (252 letters) More stufff here ... (5 Replies)
Discussion started by: Deep9000
5 Replies

2. Shell Programming and Scripting

Concatenating and appending string based on specific pattern match

Input #GEO-1-type-1-fwd-Initial 890 1519 OPKHIJEFVTEFVHIJEFVOPKHIJTOPKEFVHIJTEFVOPKOPKHIJHIJHIJTTOPKHIJHIJEFVEFVOPKHIJOPKHIJOPKEFVEFVOPKHIJHIJEFVHIJHIJEFVTHIJOPKOPKTEFVEFVEFVOPKHIJOPKOPKHIJTTEFVEFVTEFV #GEO-1-type-2-fwd-Terminal 1572 2030... (7 Replies)
Discussion started by: patrick87
7 Replies

3. Shell Programming and Scripting

shell script: grep multiple lines after pattern match

I have sql file containing lot of queries on different database table. I have to filter specific table queries. Let say i need all queries of test1,test2,test3 along with four lines above it and sql queries can be multi lines or in single line. Input file contains. set INSERT_ID=1; set... (1 Reply)
Discussion started by: mirfan
1 Replies

4. Shell Programming and Scripting

How to insert line with between two consecutive lines that match special pattern?

I have following pattern in a file: 00:01:38 UTC abcd 00:01:48 UTC 00:01:58 UTC efgh 00:02:08 UTC 00:02:18 UTC and I need to change something like the following 00:01:38 UTC abcd 00:01:48 UTC XXXX 00:01:58 UTC efgh 00:02:08 UTC XXXX (6 Replies)
Discussion started by: jjnight
6 Replies

5. Shell Programming and Scripting

awk print pattern match line and following lines

Data: Pattern Data Data Data Data Data Data Data Data Data ... With awk, how do I print the pattern matching line, then the subsequent lines following the pattern matching line. Varying number of lines following the pattern matching line. (9 Replies)
Discussion started by: dmesserly
9 Replies

6. Shell Programming and Scripting

Multiple pattern match and print the output in a single line

I need to match two patterns in a log file and need to get the next line of the one of the pattern (out of two patterns) that is matched, finally need to print these three values in a single line. Sample Log: 2013/06/11 14:29:04 <0999> (725102) Processing batch 02_1231324 2013/06/11... (4 Replies)
Discussion started by: rpm120
4 Replies

7. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies

8. Shell Programming and Scripting

Remove multiple lines that match pattern

Not sure how I can accomplish this. I would like to remove all interfaces that have the commands I would like to see: switchport port-security, spanning-tree portfast. One line is no problem. interface FastEthernet0/8 spanning-tree portfast interface FastEthernet0/9 spanning-tree... (4 Replies)
Discussion started by: mrlayance
4 Replies

9. Shell Programming and Scripting

Removing multiple lines from input file, if multiple lines match a pattern.

GM, I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed. I am assuming that sed, awk or even perl could do what I need. I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies

10. Shell Programming and Scripting

awk to combine lines from line with pattern match to a line that ends in a pattern

I am trying to combine lines with these conditions: 1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text. 2. If condition1 is met then continue to combine lines through a line that ends with a semicolon. 3. Ignore case when matching patterns and remove any... (5 Replies)
Discussion started by: Wes Kem
5 Replies
SLIPLOGIN(8)						    BSD System Manager's Manual 					      SLIPLOGIN(8)

NAME
sliplogin -- attach a serial line network interface SYNOPSIS
sliplogin [loginname] DESCRIPTION
sliplogin is used to turn the terminal line on standard input into a Serial Line IP (SLIP) link to a remote host. To do this, the program searches the file /etc/sliphome/slip.hosts for an entry matching loginname (which defaults to the current login name if omitted). If a matching entry is found, the line is configured appropriately for slip (8-bit transparent i/o) and converted to SLIP line discipline. Then a shell script is invoked to initialize the slip interface with the appropriate local and remote IP address, netmask, etc. The usual initialization script is /etc/sliphome/slip.login but, if particular hosts need special initialization, the file /etc/sliphome/slip.login.loginname will be executed instead if it exists. The script is invoked with the parameters slipunit The unit number of the slip interface assigned to this line. E.g., 0 for sl0. speed The speed of the line. args The arguments from the /etc/sliphome/slip.hosts entry, in order starting with loginname. Only the super-user may attach a network interface. The interface is automatically detached when the other end hangs up or the sliplogin process dies. If the kernel slip module has been configured for it, all routes through that interface will also disappear at the same time. If there is other processing a site would like done on hangup, the file /etc/sliphome/slip.logout or /etc/sliphome/slip.logout.loginname is executed if it exists. It is given the same arguments as the login script. Format of /etc/sliphome/slip.hosts Comments (lines starting with a `#') and blank lines are ignored. Other lines must start with a loginname but the remaining arguments can be whatever is appropriate for the slip.login file that will be executed for that name. Arguments are separated by white space and follow nor- mal sh(1) quoting conventions (however, loginname cannot be quoted). Usually, lines have the form loginname local-address remote-address netmask opt-args where local-address and remote-address are the IP host names or addresses of the local and remote ends of the slip line and netmask is the appropriate IP netmask. These arguments are passed directly to ifconfig(8). opt-args are optional arguments used to configure the line. EXAMPLES
The normal use of sliplogin is to create a /etc/passwd entry for each legal, remote slip site with sliplogin as the shell for that entry. E.g., Sfoo:ikhuy6:2010:1:slip line to foo:/tmp:/usr/sbin/sliplogin (Our convention is to name the account used by remote host hostname as Shostname.) Then an entry is added to slip.hosts that looks like: Sfoo `hostname` foo netmask where `hostname` will be evaluated by sh(1) to the local host name and netmask is the local host IP netmask. Note that sliplogin must be setuid to root and, while not a security hole, moral defectives can use it to place terminal lines in an unusable state and/or deny access to legitimate users of a remote slip line. To prevent this, a site can create a group, say slip, that only the slip login accounts are put in then make sure that /usr/sbin/sliplogin is in group slip and mode 4550 (setuid root, only group slip can execute binary). DIAGNOSTICS
sliplogin logs various information to the system log daemon, syslogd(8), with a facility code of daemon. The messages are listed here, grouped by severity level. Error Severity ioctl (TCGETS): reason A TCGETS ioctl() to get the line parameters failed. ioctl (TCSETS): reason A TCSETS ioctl() to set the line parameters failed. /etc/sliphome/slip.hosts: reason The /etc/sliphome/slip.hosts file could not be opened. access denied for user No entry for user was found in /etc/sliphome/slip.hosts. Notice Severity attaching slip unit unit for loginname SLIP unit unit was successfully attached. SEE ALSO
sl(4), slattach(8), syslogd(8) HISTORY
The sliplogin command is currently in beta test. BSD
January 5, 1994 BSD
All times are GMT -4. The time now is 06:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy