Sponsored Content
Top Forums Shell Programming and Scripting SED: how to remove newline after pattern? Post 302273143 by nico.ben on Friday 2nd of January 2009 08:48:24 PM
Old 01-02-2009
SED: how to remove newline after pattern?

Hi,
I have the following XML not well-indented code:

<hallo
>this is a line
</hallo>

So I need to remove the newline.

This syntax finds what I need to correct, but I don't know how to remove the newline after my pattern:

sed 's/<.*[^>]$/&/'

How can I subtract the newline after my pattern, please?

Thank you in advance,
Nico
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep and sed to find a pattern and add newline

Hello All, I have log file the result from a multithreaded process. So when a process finishes it will write to this log file as 123 rows merged. The issue is sometimes the processess finish at the same time or write to the file at the same time as 123 rows merged.145 rows merged. At... (5 Replies)
Discussion started by: ssikhar
5 Replies

2. Shell Programming and Scripting

sed remove everything up to the pattern

I have been search all over the internet to find a solution to this. I have a file that looks like: -a ItemConfig.custom=true -a Config.custom=true go -t malu -t Use=true I want to get "malu" as output, and the werid thing is the blank before go is neither space nor tab. what's the sed... (4 Replies)
Discussion started by: katrvu
4 Replies

3. Shell Programming and Scripting

sed ksh remove newline between 2 containers

If we assume that each line between the {} container is an XML document then What I want to remove the newline character from all lines within each container to have one XMDL document per line I wrote a bit of sed after trawling the web: e.g. #!/bin/sed -nf H /}/ { x s/\n//g p... (3 Replies)
Discussion started by: JamesJSC
3 Replies

4. Shell Programming and Scripting

sed/awk remove newline

Hi, I have input file contains sql queries i need to eliminate newlines from it. when i open it vi text editor and runs :%s/'\n/'/g it provides required result. but when i run sed command from shell prompt it doesn't impact outfile is still same as inputfile. shell] sed -e... (6 Replies)
Discussion started by: mirfan
6 Replies

5. Shell Programming and Scripting

remove pattern with sed

Hi, i want to remove a certain pattern when i type pwd. pwd will look like this: ..../....../....../Pat_logs/..../....../...../...... the dotted lines are just random directory names, i want it to remove the "Pat_logs/...../....../....../" part so for example: ... (5 Replies)
Discussion started by: a27wang
5 Replies

6. Shell Programming and Scripting

[solved] remove pattern with sed

Hi, i want to remove a certain pattern when i type pwd. pwd will look like this: ..../....../....../Pat_logs/..../....../...../...... the dotted lines are just random directory names, i want it to remove the "Pat_logs/...../....../....../" part so for example: ... (8 Replies)
Discussion started by: a27wang
8 Replies

7. Shell Programming and Scripting

remove newline between two string with sed command in unix shellscript

I have a file (test.dat) which contains data like this 459|199811047|a |b |shan kar|ooty| 460|199811047|a |bv |gur u|cbe| but I need it like: 459|199811047|a |b |shankar|ooty| 460|199811047|a |b |guru|cbe| While reading the data from this file, I don't want to remove newline from the end of... (4 Replies)
Discussion started by: jcrshankar
4 Replies

8. Shell Programming and Scripting

any savant ? using AWK/SED to remove newline character between two strings : conditional removal

I'd like to remove (do a pattern or precise replacement - this I can handle in SED using Regex ) ---AFTER THE 1ST Occurrence ( i.e. on the 2nd occurrence - from the 2nd to fourth occurance ) of a specific string : type 1 -- After the 1st occurrence of 1 string1 till the 1st occurrence of... (4 Replies)
Discussion started by: sieger007
4 Replies

9. UNIX for Dummies Questions & Answers

Mac OS X sed, add newline after pattern

Hi, I've been trying to work out how to add a new line to a file when the pattern matches .dmg. I've been searching Google but yet not found a working solution. Help would be appreciated... (9 Replies)
Discussion started by: pburge
9 Replies

10. Shell Programming and Scripting

sed to remove newline chars based on pattern mis-match

Greetings Experts, I am in AIX; I have a file generated through awk after processing the input files. Now I need to replace or remove the new-line characters on all lines that doesn't have a ; which is the last character on the line. I tried to use sed 's/\n/ /g' After checking through the... (6 Replies)
Discussion started by: chill3chee
6 Replies
PCRE_COMPILE2(3)					     Library Functions Manual						  PCRE_COMPILE2(3)

NAME
PCRE - Perl-compatible regular expressions SYNOPSIS
#include <pcre.h> pcre *pcre_compile2(const char *pattern, int options, int *errorcodeptr, const char **errptr, int *erroffset, const unsigned char *tableptr); DESCRIPTION
This function compiles a regular expression into an internal form. It is the same as pcre_compile(), except for the addition of the error- codeptr argument. The arguments are: pattern A zero-terminated string containing the regular expression to be compiled options Zero or more option bits errorcodeptr Where to put an error code errptr Where to put an error message erroffset Offset in pattern where error was found tableptr Pointer to character tables, or NULL to use the built-in default The option bits are: PCRE_ANCHORED Force pattern anchoring PCRE_AUTO_CALLOUT Compile automatic callouts PCRE_CASELESS Do caseless matching PCRE_DOLLAR_ENDONLY $ not to match newline at end PCRE_DOTALL . matches anything including NL PCRE_DUPNAMES Allow duplicate names for subpatterns PCRE_EXTENDED Ignore whitespace and # comments PCRE_EXTRA PCRE extra features (not much use currently) PCRE_FIRSTLINE Force matching to be before newline PCRE_MULTILINE ^ and $ match newlines within data PCRE_NEWLINE_ANY Recognize any Unicode newline sequence PCRE_NEWLINE_ANYCRLF Recognize CR, LF, and CRLF as newline sequences PCRE_NEWLINE_CR Set CR as the newline sequence PCRE_NEWLINE_CRLF Set CRLF as the newline sequence PCRE_NEWLINE_LF Set LF as the newline sequence PCRE_NO_AUTO_CAPTURE Disable numbered capturing paren- theses (named ones available) PCRE_UNGREEDY Invert greediness of quantifiers PCRE_UTF8 Run in UTF-8 mode PCRE_NO_UTF8_CHECK Do not check the pattern for UTF-8 validity (only relevant if PCRE_UTF8 is set) PCRE must be built with UTF-8 support in order to use PCRE_UTF8 and PCRE_NO_UTF8_CHECK. The yield of the function is a pointer to a private data structure that contains the compiled pattern, or NULL if an error was detected. Note that compiling regular expressions with one version of PCRE for use with a different version is not guaranteed to work and may cause crashes. There is a complete description of the PCRE native API in the pcreapi page and a description of the POSIX API in the pcreposix page. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWpcre | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for PCRE is available on http://opensolaris.org. PCRE_COMPILE2(3)
All times are GMT -4. The time now is 03:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy