Insert text file only after the first match with SED
Hello,
I'm new in Shell scripting but i should write a script, which inserts the license header out of a txt-File into the files in our Projekt. For the Java classes it runs without Problems but for XML files not. At xml-files i have to put the license Header after the xml-Header (?xml version="1.0" ... ?) but the xml Header is not only one line all the time, it could be about 2 or 3 lines.
first i tried with this.
This is searching for the expression "?>" an insert the license Header after this expression and it also runs.
But if this Expression is in the file one more time, f.e. in another xml-header whis is in a comment, the shouldn't be insert again.
so i try to find a way, that only the first match was taken to consideration and hope that somebody can help me
Hi all,
I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output.
sed '$a\
hi...
' shell > shell1
But I face problem when using the same in script. It is throwing the error as,
sed: command garbled:... (4 Replies)
I can't seem to get sed to allow me to insert text in the first line of an empty file. I have a file.txt that is a 0 byte file. I want sed to insert " fooBar" onto the first line. I've tried a few options and nothing seems to work. They work just fine if there's text in the file tho. Help? (4 Replies)
sed '1r file.txt' <source.txt >desti.txt
This example will insert 'file.txt' between line 1 and 2 of source.txt.
sed '0r file.txt' <source.txt >desti.txt
gives an error message.
Does anyone know how 'sed' can insert 'file.txt' before the first line of source.txt? (18 Replies)
Greetings all,
I am trying to match a string, and after that insert a few lines above that match.
The string is "Version 1.0.0". I need to insert a few lines ONLY above the first match (there are many Version numbers in the file). The rest of the matches must be ignored. The lines I need to... (2 Replies)
Hi!
Considering below text, how would I use sed to insert text right below the v0005-line, using the SEPARATOR-line as a pattern to search for, so two lines above the separator? I can do it right above the separator, but not 2 lines...
# v0004 - Some text
# v0005 - More text
#... (5 Replies)
Have a file which has the create statement like below
create table emp
( empno integer,
empname char(50))
primary index(empno);
i need to find a string starting with create and ends with semi-colon ;. if so insert the below statement before create statement
rename table emp to emp_rename;... (2 Replies)
Having a little trouble getting this to work just right.
I have xml files that i want to split some data.
I have 2 <name> tags within the file
I would like to take only the first tag and split the data.
tag example.
From this.
TAB<Name>smith, john</Name>
to
TAB<Name>smith,... (8 Replies)
hi all,
trying this using shell/bash with sed/awk/grep
I have two files, one containing one column, the other containing multiple columns (comma delimited).
file1.txt
abc12345
def12345
ghi54321
...
file2.txt
abc1,text1,texta
abc,text2,textb
def123,text3,textc
gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
LEARN ABOUT DEBIAN
excel::writer::xlsx::package::packager
Excel::Writer::XLSX::Package::Packager(3pm) User Contributed Perl Documentation Excel::Writer::XLSX::Package::Packager(3pm)NAME
Packager - A class for creating the Excel XLSX package.
SYNOPSIS
See the documentation for Excel::Writer::XLSX.
DESCRIPTION
This module is used in conjunction with Excel::Writer::XLSX to create an Excel XLSX container file.
From Wikipedia: The Open Packaging Conventions (OPC) is a container-file technology initially created by Microsoft to store a combination
of XML and non-XML files that together form a single entity such as an Open XML Paper Specification (OpenXPS) document.
<http://en.wikipedia.org/wiki/Open_Packaging_Conventions>.
At its simplest an Excel XLSX file contains the following elements:
____ [Content_Types].xml
|
|____ docProps
| |____ app.xml
| |____ core.xml
|
|____ xl
| |____ workbook.xml
| |____ worksheets
| | |____ sheet1.xml
| |
| |____ styles.xml
| |
| |____ theme
| | |____ theme1.xml
| |
| |_____rels
| |____ workbook.xml.rels
|
|_____rels
|____ .rels
The "Excel::Writer::XLSX::Package::Packager" class co-ordinates the classes that represent the elements of the package and writes them into
the XLSX file.
AUTHOR
John McNamara jmcnamara@cpan.org
COPYRIGHT
X MM-MMXII, John McNamara.
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
LICENSE
Either the Perl Artistic Licence <http://dev.perl.org/licenses/artistic.html> or the GPL
<http://www.opensource.org/licenses/gpl-license.php>.
DISCLAIMER OF WARRANTY
See the documentation for Excel::Writer::XLSX.
perl v5.10.1 2012-04-02 Excel::Writer::XLSX::Package::Packager(3pm)