04-16-2010
I am getting the following error,
P01:~$sed -i 's/^PRODUCTIVITY$/Reminder1\n\1reminder2/' servernotification.txt
sed: Not a recognized flag: i
Usage: sed [-n] Script [File ...]
sed [-n] [-e Script] ... [-f Script_file] ... [File ...]
---------- Post updated at 11:01 AM ---------- Previous update was at 10:57 AM ----------
P01:~$sed 's/PRODUCTIVITY/Reminder1\n&\nReminder2/' servernotification.txt
NIKIRA: sdr_rate CHANGE - 02/05/2010
NXT SERVER PASSWORD CHANGE - 02/05/2010
NXT FMSDB DB PASSWORD CHANGE - 02/05/2010
NXT BCV PASSWORD CHANGE - 22/04/2010
NXT CYBER ARC PASSSWORD CHANGE - 29/04/2010
NXT DOWNTIME ACTIVITY ON - 17/04/2010
NIKIRA DB PASSWORD CHANGE - 14/04/2010
NXT DOWNTIME ACTIVITY ON - 24/04/2010
DO NOT FORGET CYBER ARC - 14/04/2010
Reminder1nPRODUCTIVITYnReminder2 MATRIX - 14/04/2010
The output is as shown above. But I want it on seperate lines.
NIKIRA: sdr_rate CHANGE - 02/05/2010
NXT SERVER PASSWORD CHANGE - 02/05/2010
NXT FMSDB DB PASSWORD CHANGE - 02/05/2010
NXT BCV PASSWORD CHANGE - 22/04/2010
NXT CYBER ARC PASSSWORD CHANGE - 29/04/2010
NXT DOWNTIME ACTIVITY ON - 17/04/2010
NIKIRA DB PASSWORD CHANGE - 14/04/2010
NXT DOWNTIME ACTIVITY ON - 24/04/2010
DO NOT FORGET CYBER ARC - 14/04/2010
Reminder1n
PRODUCTIVITY MATRIX - 14/04/2010
nReminder2
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file nbu_faq.txt (Question/answer) which looks like this
What I am trying to do is write out each question in a file1.txt and than the question/answer in a file2.txt
like this
file1.txt
Q: What is nbu?
Q: What is blablabla...?
Q: Why ....?
file2.txt
Q: What is nbu?
A:... (4 Replies)
Discussion started by: nymus7
4 Replies
2. Shell Programming and Scripting
Hi,
I have a xml file
<cisco:name>
<cisco:mdNm>Cisco Device 7500 A Series</cisco:mdNm>
<cisco:meNm>10.1.100.19</cisco:meNm>
<cisco:ehNm>/shelf=1</cisco:ehNm>
<cisco:subname>
<cisco:meNm>10.1.100.19</cisco:meNm>
<cisco:sptp>Cisco PortA Series</cisco:sptp>
... (11 Replies)
Discussion started by: bhagirathi
11 Replies
3. Shell Programming and Scripting
Hi All,
I have almost 1000+ files and I want to search specific pattern. Looking forwarded your input.
Search for: word1.word2 (Which procedure contain this word, I need procedure name in output.
Expected output:
procedure test1
procedure test2
procedure test3
procedure test4
... (7 Replies)
Discussion started by: susau_79
7 Replies
4. Shell Programming and Scripting
Hi All,
Does anyone know how to print 1H1A....... in peal script
print line ^1H1A....... if next line equal 5R0RECEIPT....
Thank for help:D
Cat st.txt
1H1A-IN-11-5410-0009420|1010047766|dsds|1|N|IN|IN|000000|1||N|<<<line match
5R0RECEIPT|
5R0RECEIPT|... (2 Replies)
Discussion started by: kittiwas
2 Replies
5. Shell Programming and Scripting
Data:
Pattern Data Data Data
Data Data Data
Data Data Data
...
With awk, how do I print the pattern matching line, then the subsequent lines following the pattern matching line. Varying number of lines following the pattern matching line. (9 Replies)
Discussion started by: dmesserly
9 Replies
6. Shell Programming and Scripting
I have
2013-06-11 23:55:14 1Umexd-0004cm-IG <= user@domain.com
I need sed/awk operation on this, so that it should print the very next pattern only after the the pattern mach <=
ie only print user@domain.com (7 Replies)
Discussion started by: anil510
7 Replies
7. Shell Programming and Scripting
I need to match two patterns in a log file and need to get the next line of the one of the pattern (out of two patterns) that is matched,
finally need to print these three values in a single line.
Sample Log:
2013/06/11 14:29:04 <0999> (725102) Processing batch 02_1231324
2013/06/11... (4 Replies)
Discussion started by: rpm120
4 Replies
8. Shell Programming and Scripting
Hi,
I have a simple problem but i guess stupid enough to figure it out. i have thousands rows of data. and i need to find match patterns of two columns and print the number of rows. for example:
inputfile
abd abp 123
abc abc 325
ndc ndc 451
mjk lkj... (3 Replies)
Discussion started by: redse171
3 Replies
9. Shell Programming and Scripting
Hi experts,
I have a file with regexes which is used for automatic searches on several files (40+ GB).
To do some postprocessing with the grep result I need the matching line as well as the match itself.
I know that the latter could be achieved with grep's -o option. But I'm not aware of a... (2 Replies)
Discussion started by: stresing
2 Replies
10. Shell Programming and Scripting
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies
LEARN ABOUT PHP
datetime.diff
DATETIME.DIFF(3) 1 DATETIME.DIFF(3)
DateTime::diff - Returns the difference between two DateTime objects
Object oriented style
SYNOPSIS
public DateInterval DateTime::diff (DateTimeInterface $datetime2, [bool $absolute = false])
DESCRIPTION
DateInterval DateTimeImmutable::diff (DateTimeInterface $datetime2, [bool $absolute = false]) DateInterval DateTimeInterface::diff (Date-
TimeInterface $datetime2, [bool $absolute = false])
Procedural style
DateInterval date_diff (DateTimeInterface $datetime1, DateTimeInterface $datetime2, [bool $absolute = false])
Returns the difference between two DateTimeInterface objects.
PARAMETERS
o $datetime
- The date to compare to.
o $absolute
- Should the interval be forced to be positive?
RETURN VALUES
The DateInterval object representing the difference between the two dates or FALSE on failure.
EXAMPLES
Example #1
DateTime.diff(3) example
Object oriented style
<?php
$datetime1 = new DateTime('2009-10-11');
$datetime2 = new DateTime('2009-10-13');
$interval = $datetime1->diff($datetime2);
echo $interval->format('%R%a days');
?>
Procedural style
<?php
$datetime1 = date_create('2009-10-11');
$datetime2 = date_create('2009-10-13');
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%R%a days');
?>
The above examples will output:
+2 days
Example #2
DateTime object comparison
Note
As of PHP 5.2.2, DateTime objects can be compared using comparison operators.
<?php
$date1 = new DateTime("now");
$date2 = new DateTime("tomorrow");
var_dump($date1 == $date2);
var_dump($date1 < $date2);
var_dump($date1 > $date2);
?>
The above example will output:
bool(false)
bool(true)
bool(false)
SEE ALSO
DateInterval.format(3), DateTime.add(3), DateTime.sub(3).
PHP Documentation Group DATETIME.DIFF(3)