How to convert ^M appearing at end of line to unix newline?
As I have tried with ^M in 'tr' it replaced ^ to a newline.
Thanks in advance. (21 Replies)
Hi All,
I am new to Shell scripting.. I have a task to parse the text file into csv format. more then half the things has done.
But the problem is when I use the sed command in shell script. it appends newline character at the end of the line. and so when I open the file in CSV it's format... (3 Replies)
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... (1 Reply)
Hi
I what to add option to existing sed code to convert target file to lower case
#!/bin/ksh
SOURCE_DATA_DEST=/ora
TARGET_DATA_DEST=/home/oracle/alexz
TARGET_DB_SID=T102_test
sed -e "s/REUSE/SET/g" \
-e "s/NORESETLOGS/RESETLOGS/g" \
T102_ccf.sql > target.sql
Thanks (2 Replies)
Input:
--------------------------
123asd 456sdasda 789a
-------------------------
output wanted:
---------------------
123asd
456sdasda
789a
----------------------
I want this by sed in simple way
please help (I know by: tr ' ' '\n' < inputfile )I want it by sed only (5 Replies)
Hi everyone,
I'd like to use the script validatehtml which returns either the given url is HTML strict or not, using http:// validator . w3 . org .
sh validatehtml
#!/bin/bash
wget -q http:// validator . w3 .org / check?uri=$1
cat check\?uri\=$1 | sed -n '/h2/ p' | sed 's/ */ /g' | sed... (2 Replies)
Hi,
I use sed to insert text at beginning of a file. But sed inserts a newline after my text that I do not need. For example, I want to insert "foo" at the beginning of my file:
> cat myfile
This is first line.
> sed -i '1i\foo' myfile
> cat myfile
foo
This is first line.
... (5 Replies)
Removed.
My question does not make sense. and SED does see the last newline character.
But I still have a question:
How to remove the last newline character(the newline character at the end of last line) using SED?
---------- Post updated 05-01-11 at 10:51 AM ---------- Previous update was... (7 Replies)
Hi ,
I have a huge file with following records and I want to replace the last comma with ',NULL'. I try using SED but could not create a correct script .
In my opinion I need a script which can convert ,/n with ,NULL/n
1,CHANGE_MEMBER,2010-12-28 00:05:00,
2,CHANGE_MEMBER,2012-09-02... (8 Replies)
I have a variable like below:
str1="10.9.11.128\n-rwxr-xr-x user1 2019-12-29 17:53 /var/branch/custom/tg.xml 286030210\n10.9.12.129\n-rwxr-xr-x user1 2019-12-29 17:53 /app/branch/custom/tg.xml 286030210\n10.9.20.130\n-rwxr-xr-x user1 2019-12-29 17:53 /web/branch/custom/tg.xml 286030210"
I... (8 Replies)
Discussion started by: mohtashims
8 Replies
LEARN ABOUT DEBIAN
ppix::editortools::introducetemporaryvariable
PPIx::EditorTools::IntroduceTemporaryVariable(3pm) User Contributed Perl Documentation PPIx::EditorTools::IntroduceTemporaryVariable(3pm)NAME
PPIx::EditorTools::IntroduceTemporaryVariable - Introduces a temporary variable using PPI
SYNOPSIS
my $munged = PPIx::EditorTools::IntroduceTemporaryVariable->new->introduce(
code => "use strict; BEGIN {
$^W = 1;
}
my $x = ( 1 + 10 / 12 ) * 2;
my $y = ( 3 + 10 / 12 ) * 2;
",
start_location => [ 2, 19 ],
end_location => [ 2, 25 ],
varname => '$foo',
);
my $modified_code_as_string = $munged->code;
my $location_of_new_var_declaration = $munged->element->location;
DESCRIPTION
Given a region of code within a statement, replaces all occurrences of that code with a temporary variable. Declares and initializes the
temporary variable right above the statement that included the selected expression.
METHODS
new()
Constructor. Generally shouldn't be called with any arguments.
find( ppi => PPI::Document, start_location => Int, end_location => Int, varname => Str ) =item find( code => Str, start_location => Int,
end_location => Int, varname => Str )
Accepts either a "PPI::Document" to process or a string containing the code (which will be converted into a "PPI::Document") to
process.
Given the region of code specified by start_location and end_location, replaces that code with a temporary variable with the name given
in varname (defaults to "tmp"). Declares and initializes the temporary variable right above the statement that included the selected
expression.
Returns a "PPIx::EditorTools::ReturnObject" with the modified code as a string available via the "code" accessor (or as a
"PPI::Document" via the "ppi" accessor), and the "PPI::Token" where the new variable is declared available via the "element" accessor.
Croaks with a "no token" exception if no token is found at the location. Croaks with a "no statement" exception if unable to find the
statement.
SEE ALSO
This class inherits from "PPIx::EditorTools". Also see App::EditorTools, Padre, and PPI.
perl v5.14.2 2012-03-11 PPIx::EditorTools::IntroduceTemporaryVariable(3pm)