Sponsored Content
Top Forums Shell Programming and Scripting Multi-line Substitution Gone Awry - perl Post 302191691 by EmperorNorton on Sunday 4th of May 2008 11:31:48 AM
Old 05-04-2008
Data

Something not working at all is one thing, but something inexplicably working sometimes is an even great frustration.

The code posted by danmero works great for the code example I had given, but performs no substitution when given the following as input:
Code:
H	 3.228216   -1.558532	-0.403837

P
6-311+G(d)
****
O N
6-311+G(d)
****
C
6-311+G(d)
****
H
6-311+G(d)
****

I use:
Code:
sed 'N;/^H/s/+G(d)/++G(d,p)/g' in > out

and no change is made in the output. Anyone have any ideas? I'm really confused because it seems to me that the conditions for the substitution don't really change at all, and the condition appears in this input file exactly as it does in the input which work with the sed code.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use Perl to merge multi-line into single line

Hi, Can anyone know how to use perl to merge the following multi-line information which beginning with "BAM" into one line. For each line need to delete the return and add a space. Please see the red color line. ******Org. Multi-line) BAM admin 101.203.57.22 ... (3 Replies)
Discussion started by: happyday
3 Replies

2. Shell Programming and Scripting

How to use Perl to join multi-line into single line

Hello, Did anyone know how to write a perl script to merge the multi-line into a single line where each line with start at timestamp Input--> timestamp=2009-11-10-04.55.20.829347; a; b; c; timestamp=2009-11-10-04.55.20.829347; aa; bb; cc; (5 Replies)
Discussion started by: happyday
5 Replies

3. Shell Programming and Scripting

perl regex multi line cut

hello mighty all there's a file with lots of comments.. some of them looks like: =comment blabla blablabla bla =cut i'm trying to cut this out completely with this code: $line=~s/^=.+?=cut//sg; but no luck also tryed to change it abit but still I don't understand how the... (9 Replies)
Discussion started by: tip78
9 Replies

4. Shell Programming and Scripting

Merge multi-line output into a single line

Hello I did do a search and the past threads doesn't really solve my issue. (using various awk commands) I need to combine the output from java -version into 1 line, but I am having difficulties. When you exec java -version, you get: java version "1.5.0_06" Java(TM) 2 Runtime... (5 Replies)
Discussion started by: flagman5
5 Replies

5. Shell Programming and Scripting

Joining multi-line output to a single line in a group

Hi, My Oracle query is returing below o/p ---------------------------------------------------------- Ins trnas value a lkp1 x a lkp1 y b lkp1 a b lkp2 x b lkp2 y ... (7 Replies)
Discussion started by: gvk25
7 Replies

6. Shell Programming and Scripting

Multi-line filtering based on multi-line pattern in a file

I have a file with data records separated by multiple equals signs, as below. ========== RECORD 1 ========== RECORD 2 DATA LINE ========== RECORD 3 ========== RECORD 4 DATA LINE ========== RECORD 5 DATA LINE ========== I need to filter out all data from this file where the... (2 Replies)
Discussion started by: Finja
2 Replies

7. Shell Programming and Scripting

Perl one-line substitution syntax

Hi, With the following Perl syntax, how to print the $_ value after the substitution? s/(\s*|\n)//g foreach (<>); If I use the below code, it produces some numeric output print s/(\s*|\n)//g foreach (<>); (2 Replies)
Discussion started by: royalibrahim
2 Replies

8. Shell Programming and Scripting

Replacing lines matching a multi-line pattern (sed/perl/awk)

Dear Unix Forums, I am hoping you can help me with a pattern matching problem. What am I trying to do? I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Discussion started by: thefang
10 Replies

9. Shell Programming and Scripting

Help with reformat single-line multi-fasta into multi-line multi-fasta

Input File: >Seq1 ASDADAFASFASFADGSDGFSDFSDFSDFSDFSDFSDFSDFSDFSDFSDFSD >Seq2 SDASDAQEQWEQeqAdfaasd >Seq3 ASDSALGHIUDFJANCAGPATHLACJHPAUTYNJKG ...... Desired Output File >Seq1 ASDADAFASF ASFADGSDGF SDFSDFSDFS DFSDFSDFSD FSDFSDFSDF SD >Seq2 (4 Replies)
Discussion started by: patrick87
4 Replies

10. Shell Programming and Scripting

Multi line log files to single line format

I want to read the log file which was generate from other command . And the output was having multi line in log files for job name and server name. But i need to make all the logs on one line Source file 07/15/2018 17:02:00 TRANSLOG_1700 Server0005_SQL ... (2 Replies)
Discussion started by: ranjancom2000
2 Replies
MB_SUBSTITUTE_CHARACTER(3)						 1						MB_SUBSTITUTE_CHARACTER(3)

mb_substitute_character - Set/Get substitution character

SYNOPSIS
mixed mb_substitute_character ([mixed $substrchar = mb_substitute_character()]) DESCRIPTION
Specifies a substitution character when input character encoding is invalid or character code does not exist in output character encoding. Invalid characters may be substituted NULL (no output), string or integer value (Unicode character code value). This setting affects mb_convert_encoding(3), mb_convert_variables(3), mb_output_handler(3), and mb_send_mail(3). PARAMETERS
o $substrchar - Specify the Unicode value as an integer, or as one of the following strings: o "none": no output o "long": Output character code value (Example: U+3000, JIS+7E7E) o "entity": Output character entity (Example: ) RETURN VALUES
If $substchar is set, it returns TRUE for success, otherwise returns FALSE. If $substchar is not set, it returns the current setting. EXAMPLES
Example #1 mb_substitute_character(3) example <?php /* Set with Unicode U+3013 (GETA MARK) */ mb_substitute_character(0x3013); /* Set hex format */ mb_substitute_character("long"); /* Display current setting */ echo mb_substitute_character(); ?> PHP Documentation Group MB_SUBSTITUTE_CHARACTER(3)
All times are GMT -4. The time now is 06:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy