The sed command above would replace only the first occurrence of ; on a line -- to replace ALL semicolons, you need to specify global replacement:
That will replace every instance of a semicolon with a semicolon, backslash, and "n".
The portable way of including a newline in the replacement text requires preceding an actual newline character with a backslash (posix does not recognize \n in the replacement text).
Hi
I need some help using shell script to edit a file.
My original file has the following format:
/txt/email/myemail.txt
/txt/email/myemail2.txt
/pdf/email/myemail.pdf
/pdf/email/myemail2.pdf
/doc/email/myemail.doc
/doc/email/myemail2.doc
I need to read each line. If the path is... (3 Replies)
I have a requirement, which is as follows
*. Folder contains list of xmls. Script has to create new xml files by copying the existing one and renaming it by appending "_pre.xml" at the end.
*. Each file has multiple <Name>fileName</Name> entry. The script has to find the first occurance of... (1 Reply)
Hi all,
I need to write an automated bash shell script which performs such operations:
1. Grep the header of everyline with the initial of "T" in "FILE_A"
2. Perform a for loop,
Count the numbers of comma in the line of code,
if (no. of comma < 17)
ADD the comma until 17;
... (2 Replies)
Can we use a here document inside a here document?
Something like this
ssh user@remotehost << REMOTE
sudo vserver vsernamename enter << VSERVER
perform actions on vserver.
VSERVER
REMOTE (6 Replies)
dear all,
i need your help to change this input to output
M9_3D_H10__Dflt
->SP_M9N_S
497224.3125 1598028.1250
497063.2813 1598002.7500
496953.1250 1597951.8750
497122.6250 1597985.7500
497190.4375 1597994.2500... (3 Replies)
How to edit file content at the specific line? For example at below
The things to edit --> This is line 2. And it is below line 1.
This is line 1.
This is line 2. # i want to append some words at this row line. How?
This is line 3. (8 Replies)
Hi Experts,
I am new to shell scripting. Need some help in doing one task given by the customer.
The sample record in a file is as follows:
3538,,,,,,ID,ID1,,,,,,,,,,,
It needs to be the following:
3538,,353800,353800,,,ID,ID1,,,,,COLX,,,,,COLY,
And i want to modify this record in... (3 Replies)
I'm working on a script to execute a number of items. One being, editing particular files to add certain lines. I'm attempting to utilize sed, but, having issues when running from a bash script. Assistance is greatly appreciated.
My example:
sed -i '14 i\
# add these lines
add these lines to... (5 Replies)
Discussion started by: Nvizn
5 Replies
LEARN ABOUT DEBIAN
dist::zilla::role::ppi
Dist::Zilla::Role::PPI(3pm) User Contributed Perl Documentation Dist::Zilla::Role::PPI(3pm)NAME
Dist::Zilla::Role::PPI - a role for plugins which use PPI
VERSION
version 4.300020
DESCRIPTION
This role provides some common utilities for plugins which use PPI
METHODS
ppi_document_for_file
my $document = $self->ppi_document_for_file($file);
Given a dzil file object (anything that does Dist::Zilla::Role::File), this method returns a new PPI::Document for that file's content.
Internally, this method caches these documents. If multiple plugins want a document for the same file, this avoids reparsing it.
save_ppi_document_to_file
my $document = $self->save_ppi_document_to_file($document,$file);
Given a PPI::Document and a dzil file object (anything that does Dist::Zilla::Role::File), this method saves the serialized document in the
file.
It also updates the internal PPI document cache with the new document.
document_assigns_to_variable
if( $self->ppi_document_for_file($document, '$FOO')) { ... }
This method returns true if the document assigns to the given variable.
AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-06-21 Dist::Zilla::Role::PPI(3pm)