Sponsored Content
Top Forums Shell Programming and Scripting calculating unique strings values Post 302598806 by Paulwintech on Wednesday 15th of February 2012 01:17:02 PM
Old 02-15-2012
Thank You!!! Hurray it works perfect..... Thank you so much

---------- Post updated at 11:47 PM ---------- Previous update was at 11:34 PM ----------

Hi,

i have another small request, need to remove double/triple space in between a content to single space in a file as below example.

File
bags 15 13
bags 15 14
blazer 24 24
blazer 33 32
boots 19 15

Result should be single space between the content
bags 15 13
bags 15 14
blazer 24 24
blazer 33 32
boots 19 15

Thanks
wintech

Last edited by Paulwintech; 02-15-2012 at 02:40 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

to retrieve unique values

Hi all, I have a 10.txt file. In this file 2 words are present by name Active and Inactive and these words are repeated 7000 times. I want to take the unique 2 words from this 7000 lines. Thanks Mahalakshmi.A (3 Replies)
Discussion started by: mahalakshmi
3 Replies

2. Shell Programming and Scripting

Getting Unique values in a file

Hi, I have a file like this: Some_String_Here 123 123 123 321 321 321 3432 3221 557 886 321 321 I would like to find only the unique values in the files and get the following output: Some_String_Here 123 321 3432 3221 557 886 I am trying to get this done using awk. Can someone please... (5 Replies)
Discussion started by: Legend986
5 Replies

3. UNIX for Dummies Questions & Answers

Finding Unique strings which match pattern

I need to grep for a pattern in a file. Files are huge and have several repeated occurances of the strings which match pattern. I just need the strings which contain the pattern in the output. For eg. The contents of my file are as follows. The pattern I want to match by is ABCD ... (5 Replies)
Discussion started by: tektips
5 Replies

4. Shell Programming and Scripting

How to count unique strings

How do I count the total number of unique strings from a file using Perl? Any help is appreciated.. (6 Replies)
Discussion started by: my_Perl
6 Replies

5. UNIX for Dummies Questions & Answers

Calculating the Hours between two time values

Dear Folks, I want to calculate the elapsed hours between two time columns. I am using timestampdiff method for the same. I am able to get the value. But facing an issue of decimal values. For example the elapsed hours between 09:00:00 and 20:30:00 is coming as 11 instead of 11.5. I am using below... (1 Reply)
Discussion started by: dinesh1985
1 Replies

6. Shell Programming and Scripting

Calculating frequency of values within bins

Hi, I am working with files containing 2 columns in which i need to come up with the frequency/count of values in col. 2 falling within specifics binned values of col. 1. the contents of a sample file is shown below: 15 12.5 15 11.2 16 0.2 16 1.4 17 1.6 18 4.5 17 5.6 12 8.6 11 7.2 9 ... (13 Replies)
Discussion started by: ida1215
13 Replies

7. Shell Programming and Scripting

AWK, Perl or Shell? Unique strings and their maximum values from 3 column data file

I have a file containing data like so: 2012-01-02 GREEN 4 2012-01-02 GREEN 6 2012-01-02 GREEN 7 2012-01-02 BLUE 4 2012-01-02 BLUE 3 2012-01-02 GREEN 4 2012-01-02 RED 4 2012-01-02 RED 8 2012-01-02 GREEN 4 2012-01-02 YELLOW 5 2012-01-02 YELLOW 2 I can't always predict what the... (4 Replies)
Discussion started by: rich@ardz
4 Replies

8. Shell Programming and Scripting

Finding a text in files & replacing it with unique strings

Hallo Everyone. I have to admit I'm shell scripting illiterate . I need to find certain strings in several text files and replace each of the string by unique & corresponding text. I prepared a csv file with 3 columns: <filename>;<old_pattern>;<new_pattern> ... (5 Replies)
Discussion started by: gordom
5 Replies

9. Shell Programming and Scripting

Command to show unique strings in two files

how to display the unique strings in two files using shell script or commands. I tried diff and cmp but it shows the entire line, i need only the mismatched strings. File1: sat,sun,mon,tue rose,lilly,lotus white,red,blue,green,pink File2: sat,sun,mon,tue rose,sunflower,lotus... (4 Replies)
Discussion started by: Arun_Linux
4 Replies

10. UNIX for Beginners Questions & Answers

Code to get unique values

Hello All, I am trying to write a script which returns me clientID,programId,userID indicated in bold from the below log files.Log file is having many such data , iam just presenting sample . Sample Log file. hostname 1525867288264 UA:MP:EP491418 http-nio-8080-exec-11 ERROR Get Price... (13 Replies)
Discussion started by: nextStep
13 Replies
BLAZER(8)							    NUT Manual								 BLAZER(8)

NAME
blazer - Driver for Megatec/Q1 protocol serial (blazer_ser) and USB (blazer_usb) based UPS equipment NOTE
This man page only documents the hardware-specific features of the blazer driver. For information about the core driver, see nutupsdrv(8). SUPPORTED HARDWARE
The blazer driver is known to work with various UPSes from Blazer, Energy Sistem, Fenton Technologies, General Electric, Mustek and many others. The NUT compatibility table lists all the known supported models. Keep in mind, however, that other models not listed there may also be supported, but haven't been tested. All devices with a serial interface (use the blazer_ser driver) and many with a USB interface (use the blazer_usb driver) are supported. EXTRA ARGUMENTS
You may need to override or provide defaults for some values, depending on the make and model of your UPS. The following are the ones that most likely will need changing (see ups.conf(5)): default.battery.voltage.high = value Maximum battery voltage that is reached after about 12 to 24 hours charging. If you want the driver to report a guesstimated battery.charge, you need to specify this (see BATTERY CHARGE). default.battery.voltage.low = value Minimum battery voltage just before the UPS automatically shuts down. If you want the driver to report a guesstimated battery.charge, you need to specify this (see BATTERY CHARGE). default.battery.voltage.nominal = value, override.battery.voltage.nominal = value Some devices show a wrong nominal battery voltage (or none at all), so you may need to override or set a default value. override.battery.packs = value Some devices report a part of the total battery voltage. For instance, if battery.voltage.nominal is 24 V, but it reports a battery.voltage of around 2 V, the number of battery.packs to correct this reading would be 12. The driver will attempt to detect this automatically, but if this fails somehow, you may want to override this value. ondelay = value Time to wait before switching on the UPS (minutes). Note that a value below 3 minutes, may cause earlier firmware versions to not switch on automatically, so it defaults to 3 minutes. offdelay = value Time to wait before shutting down the UPS (seconds). This value is truncated to units of 6 seconds (less than 60 seconds) or 60 seconds (more than 60 seconds). Defaults to 30 seconds. norating Some UPSes will lock up if you attempt to read rating information from them. Setting this flag will make the driver skip this step. novendor Some UPSes will lock up if you attempt to read vendor information from them. Setting this flag will make the driver skip this step. protocol = string Skip autodetection of the protocol to use and only use the one specified. Supported values megatec, megatec/old, mustek and zinto. runtimecal = value,value,value,value Parameter used in the (optional) runtime estimation. This takes two runtimes at different loads. Typically, this uses the runtime at full load and the runtime at half load. For instance, if your UPS has a rated runtime of 240 seconds at full load and 720 seconds at half load, you would enter runtimecal = 240,100,720,50 The first load should always be higher than the second. If you have values available for loads other than 100 and 50 % respectively, you can use those too, but keep them spaced apart as far as reasonably possible. Just don't get too close to no load (prediction of runtime depends more on idle load for the battery then). chargetime = value The time needed to fully recharge the battery after being fully discharged. If not specified, the driver defaults to 43200 seconds (12 hours). Only used if runtimecal is also specified. idleload = value Minimum battery load used by the driver to estimate the runtime. If not specified, the driver defaults to 10%. Only used if runtimecal is also specified. SERIAL INTERFACE ONLY
cablepower = string By default the driver will set DTR and clear RTS (normal). If you find that your UPS isn't detected or the communication with the UPS is unreliable, you may try if clear DTR and set RTS (reverse), set DTR and RTS (both) or clear DTR and RTS (none) improves this situation. USB INTERFACE ONLY
vendorid = regex, productid = regex, vendor = regex, product = regex, serial = regex Select a specific UPS, in case there is more than one connected via USB. Each option specifies an extended regular expression (see regex(7)) that must match the UPS's entire vendor/product/serial string (minus any surrounding whitespace), or the whole 4-digit hexadecimal code for vendorid and productid. Try -DD for finding out the strings to match. Examples: -x vendor="Foo.Corporation.*" -x vendorid=051d # (APC) -x product=".*(Smart|Back)-?UPS.*" bus = regex Select a UPS on a specific USB bus or group of busses. The argument is a regular expression that must match the bus name where the UPS is connected (e.g. bus="002", bus="00[2-3]"). subdriver = string Select a serial-over-USB subdriver to use. You have a choice between phoenix, ippon, cypress, and krauler. When using this option, it is mandatory to also specify the vendorid and productid. langid_fix = value Apply the language ID workaround to the krauler subdriver. This is mandatory for some devices to work (LDLC, Dynamix and others). You must to provide value (0x409 or 0x4095), according to your device entry in NUT hardware compatibility list (HCL). UPS COMMANDS
This driver supports some instant commands (see upscmd(8)): beeper.toggle Toggle the UPS beeper. (Not available on some hardware.) load.on Turn on the load immediately. load.off Turn off the load immediately (see KNOWN PROBLEMS). shutdown.return [value] Turn off the load and return when power is back. Uses the timers defined by ondelay and offdelay. shutdown.stayoff [value] Turn off the load and remain off (see KNOWN PROBLEMS). Uses the timer defined by offdelay. shutdown.stop Stop a shutdown in progress. test.battery.start.deep Perform a long battery test (Not available on some hardware.) test.battery.start.quick Perform a (10 second) battery test. test.battery.start value Perform a battery test for the duration of value seconds (truncated to units of 60 seconds). test.battery.stop Stop a running battery test (not available on some hardware.) BATTERY CHARGE
Due to popular demand, this driver will report a guesstimated battery.charge and optionally battery.runtime, provided you specified a couple of the EXTRA ARGUMENTS listed above. If you specify both battery.voltage.high and battery.voltage.low in ups.conf(5), but don't enter runtimecal, it will guesstimate the state of charge by looking at the battery voltage alone. This is not reliable under load, as this only gives reasonably accurate readings if you disconnect the load, let the battery rest for a couple of minutes and then measure the open cell voltage. This just isn't practical if the power went out and the UPS is providing power for your systems. battery.voltage - battery.voltage.low battery.charge = ------------------------------------------ x 100 % battery.voltage.high - battery.voltage.low There is a way to get better readings without disconnecting the load but this requires one to keep track on how much (and how fast) current is going in- and out of the battery. If you specified the runtimecal, the driver will attempt to do this. Note however, that this heavily relies on the values you enter and that the UPS must be able to report the load as well. There are quite a couple of devices that report 0 % (or any other fixed value) at all times, in which case this obviously doesn't work. The driver also has no way of determining the degradation of the battery capacity over time, so you'll have to deal with this yourself (by adjusting the values in runtimecal). Also note that the driver guesses the initial state of charge based on the battery voltage, so this may be less than 100 %, even when you are certain that they are full. There is just no way to reliably measure this between 0 and 100 % full charge. This is better than nothing (but not by much). If any of the above calculations is giving you incorrect readings, you are the one that put in the values in ups.conf(5), so don't complain with the author. If you need something better, buy a UPS that reports battery.charge and battery.runtime all by itself without the help of a NUT driver. NOTES FOR THE PREVIOUS USER OF MEGATEC DRIVERS
The blazer drivers having replaced the megatec ones, some configuration changes may be required by users switching to blazer. Part of this, the following megatec options, in ups.conf, have to be changed: battvolts You need to use default.battery.voltage.high and default.battery.voltage.low dtr and rts You need to use cablepower ignoreoff This parameter can simply be discarded, since it was a wrong understanding of the specification. KNOWN PROBLEMS
Some UPS commands aren't supported by all models. In most cases, the driver will send a message to the system log when the user tries to execute an unsupported command. Unfortunately, some models don't even provide a way for the driver to check for this, so the unsupported commands will silently fail. Both the load.off and shutdown.stayoff instant commands are meant to turn the load off indefinitely. However, some UPS models don't allow this. Some models report a bogus value for the beeper status (will always be enabled or disabled). So, the beeper.toggle command may appear to have no effect in the status reported by the driver when, in fact, it is working fine. The temperature and load value is known to be bogus in some models. AUTHORS
Arjen de Korte <adkorte-guest at alioth.debian.org>, Alexander Gordeev <lasaine at lvk.cs.msu.su> SEE ALSO
nutupsdrv(8), upsc(8), upscmd(8), upsrw(8) Internet Resources: The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ The NUT HCL: http://www.networkupstools.org/stable-hcl.html Network UPS Tools 05/21/2012 BLAZER(8)
All times are GMT -4. The time now is 09:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy