11-22-2010
replace (sed?) a single line/string in file with multiple lines (string) from another file??
Can someone tell me how I can do this?
e.g:
Say file1.txt contains:
today is monday
the 22 of
NOVEMBER
2010
and file2.txt contains:
the
11th
month
of
How do i replace the word NOVEMBER with
the
11th
month
of
so output file is:
today is monday
the 22 of
the
11th
month
of
2010
Thanks for your help!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
i call my shell like:
my_shell "my project name"
my script:
#!/bin/bash -vx
projectname=$1
sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp
cp temp test_config_doxy
the following error occurres:
sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies
2. Shell Programming and Scripting
Hi Guys,
I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same.
can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies
3. Shell Programming and Scripting
Hello everyone,
ive been trying to replace a string "kw01" in an xml file with the contents of a txt file having multiple lines. im a unix newbie and all the sed combinations i tried resulted to being garbled. Below is the contents of the txt file:
RAISEDATTIME
--------------------... (13 Replies)
Discussion started by: 4dirk1
13 Replies
4. Shell Programming and Scripting
Would appear to me to be a farily simple question but having search all the threads I can't find the answer .. I just want sed to output the single line in a file that contains two string anywhere on the line..
e.g. currently using this command
sed -n -e'/str1/p' -e '/str2/p' < file
and... (3 Replies)
Discussion started by: flopster
3 Replies
5. Shell Programming and Scripting
Can someone tell me how I can do this?
e.g:
a=$(echo -e wert trewt ertert ertert ertert erttert
erterte
rterter
tertertert
ert)
How do i replace the STRING with $a?
I try this:
sed -i 's/STRING/'"$a"'/g' filename.ext
but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies
6. Shell Programming and Scripting
Hi,
1_strings file contains
$ cat 1_strings
/home/$USER/Src
/home/Valid
/home/Review$ cat myxml
<projected value="some string" path="/home/$USER/Src">
<input 1/>
<estimate value/>
<somestring/>
</projected>
<few more lines >
<projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies
7. Shell Programming and Scripting
Hi experts,
In my text file I have the following alot of lines like below.
input.k is as follows.
2684717 -194.7050476 64.2345581 150.6500092 0 0
2684718 -213.1575623 62.7032242 150.6500092 0 0
*INCLUDE
$# filename... (3 Replies)
Discussion started by: hamnsan
3 Replies
8. UNIX for Dummies Questions & Answers
Hi Everyone,
I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file.
I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies
9. Shell Programming and Scripting
Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file:
</member>
<member>
<name>TransactionID</name>
<value><string>123456789123456</string></value>
</member>
<member>
<name>Number</name>
... (9 Replies)
Discussion started by: cozzin
9 Replies
10. Shell Programming and Scripting
I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: -->
cat comp.pkglist
Package list: nss-util-devel-3.28.4-1.el6_9.x86_64
Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies
LEARN ABOUT DEBIAN
ical::parser::sax
iCal::Parser::SAX(3pm) User Contributed Perl Documentation iCal::Parser::SAX(3pm)
NAME
iCal::Parser::SAX - Generate SAX events from an iCalendar
SYNOPSIS
use iCal::Parser::SAX;
my $parser=iCal::Parser::SAX->new(Handler=>SAXHandler,%args);
$parser->parse_uri($file);
$parser->parse_uris(@files);
DESCRIPTION
This module uses iCal::Parser to generates SAX events for the calendar contents.
The xml document generated is designed for creating monthly calendars with weeks beginning on monday (e.g., by passing the output through
an xsl styleheet).
The basic structure of the generated document (if output through a simple output handler like "XML::SAX::Writer"), is as follows:
<ical>
<calendars>
<calendar id="cal-id" index="n" name="..." description="..."/>
</calendars>
<events>
<year year="YYYY">
<month month="[1-12]">
<week week="n">
<day date="YYYY-MM-DD">
<event uid="event-id" idref="cal-id" [all-day="1"]>
<!-- ... -->
</event>
</day>
</week>
</month>
</events>
<todos>
<todo idref="cal-id" uid="...">
<!--- ... -->
</todo>
</todos>
</ical>
Along with basics, such as converting calendar attributes to lowercase elements (e.g., a "DTSTART" attribute in the input would generate a
sax event like "element({Name="'dtstart'})>), a number of other processes occur:
o "day" elements are are generated for each date within the months from the first month in the input to the last, even if there are no
calendar events on that day. This guarantees a complete calendar month for further processing. If there is an overlap between two or
more events, the attribute "conflict", containing the number of concurrent overlaps, is added to the element.
o If the beginning or end of the month does not start on a monday, or end on a sunday, the days from the previous (next) month month are
duplicated within the first (last) week of the current month, including duplicate copies of any calendar events occuring on those days.
This allows for displaying a monthly calendar the same way a program such as Apple's iCal would, with calendar events showing up if
they fall within the overlapping days in the first or last week of a monthly calendar.
METHODS
Along with the standard SAX parsing methods "parse_uri", "parse_file", etc.), the following methods are supported.
new(%args)
Create a new SAX parser. All arguments other than "Handler" and "no_escape" are passed to iCal::Parser.
Arguments
Handler
The SAX handler.
no_escape
If not set, quotes, ampersands and apostrophes are converted to entites. In any case < is converted to an entity, "\n" is converted
to the return entity and double backslashes ("\") are removed.
parse_uris(@uris)
Pass all the input uris to "iCal::Parser" and generate a combined output calendar.
parse_hash($hash)
Parse the hash returned from iCal::Parser::calendar directly.
AUTHOR
Rick Frankel, cpan@rickster.com
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
iCal::Parser, XML::SAX::Base
perl v5.14.2 2012-08-05 iCal::Parser::SAX(3pm)