interesting suggestion, to use \r\n (carriage return & new line) instead of just \n in the command
The reason is that Unix- and DOS-systems (and their descendants) have different line-ending sequences: UNIX always had a single-character (newline) as line-separator whereas DOS had no real print-processor program. Therefore its inventors made "carriage-return"+"line-feed" the line separator, so that the printer (we are talking typewriter-like printers here) could use that sequence directly.
Quote:
Originally Posted by prooney
unfortunately, I got the same results where sed just echoes back the input:
Maybe you have some (unwanted) whitespace at the end of the line which makes your regexp not matching the text? You could analyse your input data with the od command: use od -ax /your/file to get a hex dump.
Thank you for the suggestion to check spaces (hex 20) at the end of the lines. The command
yields
I don't see any spaces at the end of any of the three lines.
I also tried the single line sed command with the multi-line flag m:
but it still just echoed back the input file:
Dear all,
I try to replace a string of characters in a file (MyFile.txt) by a multiline value of the variable "Myvar":
$ cat MyFile.txt
DESCRIPTION '@TargetTable SCHEMA'
(
@InputFlowDef
);
$
The content of Myvar:
$ echo "$Myvar"
col1
, col2
, col3
$ (4 Replies)
Hi guys,
I am fairly comfortable with using the sed command if the string to be replaced is all on a single line.
I was wondering is it possible to use sed command in a multiline way ?
Say for example I have the below string on 2 different lines:
{
"key": "brandNameA",
... (3 Replies)
I'm trying to extract a subject from a mail message but my subject example has 2 lines. How can I manage to extract it and write a string at the end of it?
Consider this example:
From: test@domain.com
Subject: Re: U =?ISO-8859-1?Q?qu=EA=3F!=3F!=3F!!_wtff_=E7=E3o_=ED=F3?=
... (6 Replies)
Hey everyone, I'm new to sed and I need to create a script for inserting one line of code at the beginning of every method in a Xcode project (over 6,000 methods). Each method Structure is
(+ or -) (Various declarations-- could span multiple lines) ({)
I've tried for days, any guidance would be... (2 Replies)
How can I write a script that takes a cisco config file and outputs every occurrence of two, or more, pattern matches through the whole config file?
For example, out of a config file, i want to print out every line with interface, description and ip address through the whole file, and disregard... (3 Replies)
Hi.
I have the following text file (more precisely a Matlab script):
dummy1 = 5; varx = 'false'; dummy2 = 6;
% ... some general commands
% ...
dummy3 = 7; vary = 'option1'; dummy4 = 8;
Using sed I want to do the following action:
IF varx = 'false' vary='NEW_VALUE_1'... (11 Replies)
Hi friends,
Could you please help me to resolve the below issue.
Input file :-
<Node>
<username>abc</username>
<password>ABC</password>
<Node>
<Node>
<username>xyz</username>
<password>XYZ</password>
<Node>
<Node>
<username>mnp</username>
... (3 Replies)
Hi,
I have file which has the following content...
GOOD MORNING
**********WARNING**********
when it kicks from the kickstart, sshd daemon should start at last.
(WHEN KICKING ITSELF, NOT AFTER KICKING).
/etc/rc3.d/S55sshd ( run level specification for sshd is 55, now I would want to... (4 Replies)
I have a data of the form
0.0117843924 0. 0. 0. 0.
0.011036017 0. 0. 0. 0.
0.0103351669 0. 0. 0. 0.
4839.41211 0. 0. 0. 0.
4532.08203 0. 0. 0. 0.
I would like to insert a couple of blank lines before the 4839 line, every time it appears. The numbers in the... (2 Replies)