Appreciate your help!It works..Just that the output of awk operation is coming in a single line.From the man page of awk,I realized that gsub,split don't recognize new line characters. Is there any way that the op can be in this format?
File 1:
File 2:
Desired op is:file 2 should be:
After running the command now,it comes in a single line.
Last edited by manish72; 03-04-2011 at 05:52 AM..
Reason: corrcted format of desired op.
the problem is while replacing the old string with new one with the help of SED i am unable to replace the special characters with new strings. how can i do that?
i dont want the user to be given the trouble to write '\' before every special characters like * , . , \ , $ , &.
sed... (4 Replies)
Hello everyone,
I'm writing a script to add a string to an XML file, right after a specified string that only occurs once in the file. For testing purposes I created a file 'testfile' that looks like this:
1
2
3
4
5
6
6
7
8
9
And this is the script as far as I've managed:
... (2 Replies)
Hi,
I have tonnes of .txt files that are written in French. I need to replace the French special characters, however, with English equivalents (e.g. é -> e and ç -> c).
I have tried this
---
#!/bin/bash
# Convert French characters to normal characters
# Treat each of the files
exec... (4 Replies)
Hello,
I have a file with many lines with below format:
\abc\\1234
jkl\\567
def\\345
\pqr\\567
\xyz\\234
Here, i need to do 2 things.
1. replace \\ with \
2. remove starting \
so output to be as below: (11 Replies)
Hello. How can i put all of the special characters on my keyboard into a string in c++ ?
I tried this but it doesn't work.
string characters("~`!@#$%^&*()_-+=|\}]{
How can i accomplish this?
Thanks in advance. (1 Reply)
Hi All,
I have a variable like
AVAIL="\
BACK:bkpstg:testdb3.iad.expertcity.com:backtest|\
#AUTH:authstg:testdb3.iad.expertcity.com:authiapd|\
TEST:authstg:testdb3.iad.expertcity.com:authiapd|\
"
What I want to do here is that If a find # before any entry, remove the entire string... (5 Replies)
I am writing a ksh script. I need to replace a set of characters in an xml file.
FROM="ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÛÚÜÝßàáâãäåçèéêëìíîïðñòóôõö¿¶ø®";
TO="AAAAAAACEEEEIIIIDNOOOOOOUUUUYSaaaaaaceeeeiiiionooooo N R"
I have used the code- sed 's/$FROM/$TO/g'<abc.xml
But its not working.
Can anyone tell me the code to do this? (3 Replies)
**Extremely sorry for the typos in heading
Old:CAST ('${DEFAULT_HIGH_DATE}' AS DATE FORMAT 'YYYY-MM-DD')
New :CAST(CAST('${G_DEFAULT_HIGH_DATE}' AS DATE FORMAT 'MM-DD-YYYY') as DATE FORMAT 'YYYY-MM-DD')
Need to change old format as new format
cat file1
CAST ('${DEFAULT_HIGH_DATE}' AS... (1 Reply)
Hi,
Does anyone know if there is a script or program available out there that uses a conversion table to replace special characters from a file?
I am trying to remove some special characters from a file but there are several unprintable/control characters that some I need to remove but some I... (2 Replies)
Hi,
Please find attached a file that has special characters on it. It is a copy and paste from a Micro$oft file.
I don't want to use strings as it remove all the 'indentations' / 'formatting' so I am replacing them with space instead.
I am using the sed command below
sed "s/$(printf... (1 Reply)
Discussion started by: newbie_01
1 Replies
LEARN ABOUT SUNOS
dummy-ups
DUMMY-UPS(8) NUT Manual DUMMY-UPS(8)NAME
dummy-ups - Driver for multi-purpose UPS emulation
NOTE
This man page only documents the specific features of the dummy-ups driver. For information about the core driver, see nutupsdrv(8).
DESCRIPTION
This program is a multi-purpose UPS emulation tool. Its behavior depends on the running mode:
Dummy Mode
dummy-ups looks like a standard device driver to upsd(8) and allows one to change any value for testing purposes. It is both interactive,
controllable through the upsrw(1) and upscmd(1) commands (or equivalent graphical tool), and batchable through script files. It can be
configured, launched and used as any other real driver. This mode is mostly useful for development and testing purposes.
Repeater Mode
dummy-ups acts as a NUT client, simply forwarding data. This can be useful for supervision purposes. This can also allow some load sharing
between several UPS instances, using a point-to-point communication with the UPS.
IMPLEMENTATION
The port specification depends on the running mode, and allows the driver to select the right mode.
Dummy Mode
Port is a definition file name for dummy-ups. This can either be an absolute or a relative path name. In the latter case the NUT sysconfig
directory (ie /etc/nut, /usr/local/ups/etc, ...) is prepended.
For instance:
[dummy]
driver = dummy-ups
port = evolution500.dev
desc = "dummy-ups in dummy mode"
This file is generally named "something.dev". It contains a list of all valid data and associated values, and has the same format as an
upsc(8) dump (<varname>: <value>). So you can easily create definition files from an existing UPS using "upsc > file.dev". It can also be
empty, in which case only a basic set of data is available: device., driver., ups.mfr, ups.model, ups.status
Samples definition files are available in the "data" directory of the nut source tree, and generally in the sysconfig directory of your
system distribution.
Since dummy-ups will loop on reading this file, you can dynamically modify it to interact with the driver. This will avoid message spam
into your system log files, if you are using NUT default configuration.
You can also use the "TIMER <seconds>" instruction to create scheduled events sequences. For example, the following sequence will loop on
switching ups.status between "OL", "OB" and "OB LB" every minute:
ups.status: OL
TIMER 60
ups.status: OB
TIMER 60
ups.status: LB
TIMER 60
It is wise to end the script with a TIMER. Otherwise dummy-ups will directly go back to the beginning of the file.
Repeater Mode
Port is the name of a remote UPS, using the NUT form, ie:
<upsname>[@<hostname>[:<port>]]
For instance:
[repeater]
driver = dummy-ups
port = ups@hostname
desc = "dummy-ups in repeater mode"
INTERACTION
Once the driver is loaded in dummy mode, you can change any variables, except those of the driver.* and server.* collections. You can do
this by either editing the definition file, or use the upsrw(1) and upscmd(1) commands.
Note that in simulation mode, new variables can be added on the fly, by adding these to the definition file. Conversely, if you need to
remove variable (such as transient ones, like ups.alarm), simply update these by setting an empty value. As a result, they will get removed
from the data.
In repeater mode, the driver acts according to the capabilities of the UPS, and so support the same instant commands and settable values.
BACKGROUND
This driver was written in one evening to replace the previous dummycons testing driver. It was too limited and required to work from a
terminal to interact.
dummy-ups is useful for NUT client development, and other testing purpose.
It also helps the NUT Quality Assurance effort, by automating some tests on the NUT framework.
It now offers a repeater mode. This will help in building the Meta UPS approach, which allows one to build a virtual device, composed of
several other devices (either UPS, PDUs).
BUGS
Instant commands are not yet supported in Dummy Mode, and data need name/value checking enforcement, as well as boundaries or enumeration
definition.
AUTHOR
Arnaud Quette
SEE ALSO upscmd(1), upsrw(1), ups.conf(5), nutupsdrv(8)
Internet Resources:
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/
Network UPS Tools 05/21/2012 DUMMY-UPS(8)