Sponsored Content
Top Forums Shell Programming and Scripting Replace trailing whitespaces with pipe symbol using perl Post 302732541 by kar_333 on Sunday 18th of November 2012 10:43:08 AM
Old 11-18-2012
Replace trailing whitespaces with pipe symbol using perl

I want to replace the whitespace with Pipe symbol to do a multiple pattern matching for the whole text "mysqld failed start" and same as for other text messages Below are the messages stored in a file seperate by whitespace

Code:
mysqld failed start 
nfsd mount failed 
rpcbind failed to start

for each text i need to add the pipe symbol so that it will be easier to do mutliple search pattern similar to egrep.

expected o/p

Code:
mysqld failed start|nfsd mount failed|rpcbind failed to start


Last edited by Scrutinizer; 11-18-2012 at 03:06 PM.. Reason: Less information; (mod) code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove verticalbar or pipe symbol

hi guys i have 6000 rows column the text in the column has the symbol vertical bar |. i tried some of the commands to remove it but none of the commands are reconzng this symbol. would u plz help to remove this symbol from the text with any kind of unix command u r help would be appreciated ... (9 Replies)
Discussion started by: bogu0001
9 Replies

2. Shell Programming and Scripting

Problem while concating PIPE symbol with a file

Hi Gurus, I had a problem writing a pipe file. Previously i used this code to generate a tab seperated file ABCEF := ABCEF || 'to_char('|| abc_tab(col_num).col_name || ') chr(9) || '; Now i want the o/p as pipe seperated file.I changed the line as below ABCEF := ABCEF ||... (0 Replies)
Discussion started by: pssandeep
0 Replies

3. Shell Programming and Scripting

replace nulls with whitespaces in a file

Hi, i have a file which contains data in fixed length. each row contains data of 10 characters fixed length. The data in the file appears like 4567782882 some times i may recieve dat less than fixed length of 10. in such a case i find nulls appended at the trailing spaces when i do a... (2 Replies)
Discussion started by: meeragiri
2 Replies

4. Shell Programming and Scripting

PERL - Compare 2 strings, excluding whitespaces

I am creating a script to compare definitions and declarations of functions in C code, and report if the arguments are different. So I need to compare the 2 strings (args of both), how can I do that? (2 Replies)
Discussion started by: bojomojo
2 Replies

5. Shell Programming and Scripting

Remove whitespace after pipe symbol but not inside words

I have a file that looks like this: 102| #2 X 1/4-INCH| 30188| EA| FTW| A| NOT SERIAL TRACKING| NOT LOT TRACKING| TRUE| #2 X 1/4-INCH 102| #2 X 1/4-INCH| 30188| EA| VPS| A| NOT SERIAL TRACKING| NOT LOT TRACKING| TRUE| #2 X 1/4-INCH 102| #6 X 1/2"| ... (2 Replies)
Discussion started by: djehresmann
2 Replies

6. Shell Programming and Scripting

Separate letters and replace whitespaces

Input file: aaaa bbb dd. qqq wwww e. Output file: a a a a <s> b b b <s> d d . q q q <s> w w w w <s> e . Can I use sed to do so in one step? (5 Replies)
Discussion started by: Viernes
5 Replies

7. Shell Programming and Scripting

Broken pipe symbol replaced with <A6><A6>

hi, i am copying an xml file from windows to linux server using filezilla&winscp. xml file contains ¦¦ symbols, after copying xml file to server ¦¦ is replaced with <A6><A6>. tried with copying xml files from windows in ascii&binary but no luck. please suggest. thanks (1 Reply)
Discussion started by: Satyak
1 Replies

8. Shell Programming and Scripting

Remove pipe(|) symbol ina file, except the ones which are enclosed in double quotes

I have file with are delimited by pipe(|) symbol, I wanted those to be removed except the ones which are enclosed in double quotes. If your quote file is: |Life is |Beautiful"|"Indeed life |is beautiful too|"|"But unix is fun| is not"|" It should return: Life is Beautiful"|"Indeed life is... (1 Reply)
Discussion started by: Sathyapts
1 Replies

9. Shell Programming and Scripting

Remove pipe(|) symbol in except the ones which are enclosed in double quotes

I have file with are delimited by pipe(|) symbol, I wanted those to be removed except the ones which are enclosed in double quotes. If your quote file is: |Life is |Beautiful"|"Indeed life |is beautiful too|"|"But unix is fun| is not"|" It should return: Life is Beautiful"|"Indeed life is... (9 Replies)
Discussion started by: Sathyapts
9 Replies

10. Shell Programming and Scripting

How to replace the first and last character which is pipe symbol in all files within a folder?

with in my files i have the data like this, starting with a pipe and ending the line with a pipe. all i want is to replace the first and last pipe , remove those trying to use following sed command, but it is only showing on the screen the entire data of the file as if it removed, but when i... (4 Replies)
Discussion started by: cplusplus1
4 Replies
POE::Pipe::OneWay(3pm)					User Contributed Perl Documentation				    POE::Pipe::OneWay(3pm)

NAME
POE::Pipe::OneWay - a portable API for one-way pipes SYNOPSIS
my ($read, $write) = POE::Pipe::OneWay->new(); die "couldn't create a pipe: $!" unless defined $read; DESCRIPTION
The right way to create an anonymous pipe varies from one operating system to the next. Some operating systems support "pipe()". Others require "socketpair()". And a few operating systems support neither, so a plain old socket must be created. POE::Pipe::OneWay will attempt to create a unidirectional pipe using "pipe()", "socketpair()", and IO::Socket::INET, in that order. Exceptions are hardcoded for operating systems with broken or nonstandard behaviors. The upshot of all this is that an application can portably create a one-way pipe by instantiating POE::Pipe::OneWay. The work of deciding how to create the pipe and opening the handles will be taken care of internally. POE::Pipe::OneWay may be used outside of POE, as it doesn't use POE internally. PUBLIC METHODS
new [TYPE] Create a new one-way pipe, optionally constraining it to a particular TYPE of pipe. One-way pipes have two ends: a "read" end and a "write" end. On success, new() returns two handles: one for the "read" end and one for the "write" end. Returns nothing on failure, and sets $! to explain why the constructor failed. my ($read, $write) = POE::Pipe::OneWay->new(); die $! unless defined $read; TYPE may be one of "pipe", "socketpair", or "inet". When set, POE::Pipe::OneWay will constrain its search to either "pipe()", a UNIX- domain "socketpair()", or plain old sockets, respectively. Otherwise new() will try each method in order, or a particular method predetermined to be the best one for the current operating environment. BUGS
POE::Pipe::OneWay may block up to one second on some systems if failure occurs while trying to create "inet" sockets. SEE ALSO
POE::Pipe, POE::Pipe::TwoWay. AUTHOR &; COPYRIGHT POE::Pipe::OneWay is copyright 2000-2008 by Rocco Caputo. All rights reserved. POE::Pipe::OneWay is free software; you may redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-05-15 POE::Pipe::OneWay(3pm)
All times are GMT -4. The time now is 10:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy