Sponsored Content
Top Forums Shell Programming and Scripting How I can replace this command --need help Post 302123343 by sudhish on Monday 25th of June 2007 08:25:45 AM
Old 06-25-2007
Hi,

Sorry for the delay response.

This is what the scripts does.

My main script doesn't read the file cash.log, it only append SMS message to cash.log (messages format are given below).

Then the second script read the first line of cash.log ( i.e. first line “NOC-Alert:ITM_Linux_System_Statistics 06/25/2007 05:19:59-OPEN-CRITICAL-db21.1-High System thrashing - Pages paged in per second is 6518.00 and Pages paged out per second is 48.00”) send this to SMS modem (for testing new script I just redirect to $path/output)

Waite for some time and delete the first line from cash.log

Again it read the first line (this time second one i.e. NOC-Alert:APCupsOnBattery 06/25/2007 11:28:07 AM-OPEN-CRITICAL-chi2-APC(40KVA) UPS - A: UPS: On battery power in response to an input power problem) and execute the same

Second script will send SMS until cash.log become empty.

##############
$More cash.log

NOC-Alert:ITM_Linux_System_Statistics 06/25/2007 05:19:59-OPEN-CRITICAL-db21.1-High System thrashing - Pages paged in per second is 6518.00 and Pages paged out per second is 48.00
NOC-Alert:APCupsOnBattery 06/25/2007 11:28:07 AM-OPEN-CRITICAL-chi2-APC(40KVA) UPS - A: UPS: On battery power in response to an input power problem.
NOC-Alert:APCupsOnBattery 06/25/2007 12:52:50 PM-OPEN-CRITICAL-chi2-APC(40KVA) UPS - A: UPS: On battery power in response to an input power problem.
NOC-Alert:ITM_Linux_System_Statistics 06/25/2007 14:19:59-OPEN-CRITICAL-db02-High System thrashing - Pages paged in per second is 1710.00 and Pages paged out per second is 48.00.
NOC-Alert:ITM_ManagedSystem 06/25/2007 15:16:01-OPEN-FATAL-PW002-The Server Primary:PW002:NT is offline.
NOC-Alert:APCupsOnBattery 06/25/2007 03:31:22 PM-OPEN-CRITICAL-SNT01-APC(40KVA) UPS - A: UPS: On battery power in response to an input power problem.
NOC-Alert:APCupsOnBattery 06/25/2007 03:31:23 PM-OPEN-CRITICAL-PCSNT02-APC(40KVA) UPS-B: UPS: On battery power in response to an input power problem.
NOC-Alert:ITM_ManagedSystem 06/25/2007 15:16:01-OPEN-FATAL-PW002-The Server Primary:PW002:NT is offline.


Thanks in advance
Regards
Sudhish
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Command to replace character

I've been googling for the following for the past few weeks several times, but haven't yet come across something that I could easily grasp. Can someone point me in the right direction please? I'm trying to replace a character in file names, i.e. the character is a period, and I want to replace... (5 Replies)
Discussion started by: HLee1981
5 Replies

2. UNIX for Dummies Questions & Answers

vi command - replace

Hi, Given a long text file. How can I replace all full stops- with semicolon thanks, tictactoe (1 Reply)
Discussion started by: tictactoe
1 Replies

3. UNIX for Dummies Questions & Answers

find and replace command in one line using one command

Hi, I have a entry in the file as ::BSNL GUJARAT::India::OUT::NAT::REWEL::POSTPAID::919426199995 if u see this, i have the delimiter as :: , all i want is to replace "::" as ":" so how to do that.. pls help thanks (10 Replies)
Discussion started by: vasikaran
10 Replies

4. Shell Programming and Scripting

problem with replace command with tr

I have a sample file like this 7829885 7831552 + 1 1667, 0, 35934936 35937087 - 2 1281,870, 0,1281, I would like to replace values starts with comma with just value like 0, to 0 or 1667, to 1667. I can do with this by using tr -d '0,' '0' <file But the... (2 Replies)
Discussion started by: repinementer
2 Replies

5. Shell Programming and Scripting

find and replace command

Hi, i used to do on soalris box but in linux box i am not able to do advice is appreciated uname -a Linux intranet 2.4.20-pre3 #1 Tue May 6 17:55:35 IST 2008 i686 unknown $ find /usr/local/ -type f | xargs perl -pi -e 's/172.16.1.14/172.16.1.27/g' Can't remove /usr/local/bin/dbhome:... (1 Reply)
Discussion started by: prakash.gr
1 Replies

6. Shell Programming and Scripting

Please help replace character command

hi i have log : i want remove some char become like this: anybody can help me ? (7 Replies)
Discussion started by: justbow
7 Replies

7. UNIX for Dummies Questions & Answers

Replace command

Hi , I have a sequence which looks like this Lsat01000001 Lsat01000002 Lsat01000003 .. Lsat01000999 .. Lsat01100001 Lsat01278544 i want my output to look like this: seq1 seq2 seq3 ... seq999 (1 Reply)
Discussion started by: siya@
1 Replies

8. UNIX for Dummies Questions & Answers

Global replace command help

Hello - I am trying to use a global replace command but its not working. Here is the cmd I am using in vi: :%s/OLD/NEW/g However, in my "NEW" I already have a "/" which is not making the replace work: :%s/mytestscript.com:33232/mytestscript:70245/test.com/g the... (2 Replies)
Discussion started by: DallasT
2 Replies

9. Shell Programming and Scripting

sed replace command

Hi. I need to append/prefix an & character to every 'single' & character (not when there are 2 or more grouped together) I find in a file. I can do it using this cmd: cat ${file} | sed -e 's/&/&&/g' > ${new_file} How can I modify this to ensure I only replace single &'s and not operate... (11 Replies)
Discussion started by: user052009
11 Replies

10. Shell Programming and Scripting

sed Command to replace particular value.

Hi , My input file contain : list = 3 14 15 10 9 11 12 18 19 20 21 22 23 24 25 26 6 1 2 3 4 5 7 8 16 17 27 28 30 29 Expected output : list = 0 0 0 0 0 0 0 18 0 20 0 0 0 0 0 0 6 0 0 3 4 0 0 0 0 0 0 0 0 0 I want to keep the 8,10,16,17,22 value from the list and put 0 on rest of the... (9 Replies)
Discussion started by: Preeti Chandra
9 Replies
XMLSTARLET(1)							 xmlstarlet Manual						     XMLSTARLET(1)

NAME
xmlstarlet - command line XML/XSLT toolkit SYNOPSIS
xmlstarlet [<options>] [<command>] [<cmd-options>] INTRODUCTION
XMLStarlet is a set of command line utilities (tools) which can be used to transform, query, validate, and edit XML documents and files us- ing simple set of shell commands in similar way it is done for plain text files using UNIX grep, sed, awk, diff, patch, join, etc commands. This set of command line utilities can be used by those who deal with many XML documents on UNIX shell command prompt as well as for auto- mated XML processing with shell scripts. OPTIONS
--version Display the version of xmlstarlet. --help Display help. COMMANDS
Type: xmlstarlet <command> --help <ENTER> for command help Available commands include: ed (or edit) Edit/update XML document(s). sel (or select) Select data or query XML document(s) (XPATH, etc). tr (or transform) Transform XML documents(s) using XSLT. val (or validate) Validate XML document(s) (well-formed/DTD/XSD/RelaxNG). fo (or format) Format XML document(s). el (or elements) Display element structure of XML document. c14n (or canonic) XML canonicalization. ls (or list) List directory as XML. esc (or escape) Escape special XML characters. unesc (or unescape) Unescape special XML characters. pyx (or xmln) Convert XML into PYX format (based on ESIS - ISO 8879). p2x (or depyx) Convert PYX into XML. REFERENCES
XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.source- forge.net/). AUTHOR
Mikhail Grushinskiy. XMLSTARLET(1)
All times are GMT -4. The time now is 05:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy