Sponsored Content
Full Discussion: Insert a decimal point
Top Forums Shell Programming and Scripting Insert a decimal point Post 302120154 by lyoncc on Monday 4th of June 2007 03:44:16 PM
Old 06-04-2007
Insert a decimal point

Hi all. Using /bin/sh on an HPUX system.

I want to place a decimal in the field 2 charactors from the right (yes, converting to currency). The field lengths are variable. Here's what I'm doing:

exec < filename
while read FIELD1 FIELD2
do
FIELD1="echo $FIELD1 | sed 'syntax that will insert . 2 chars before rightmost' "
done

Thanks in advance!!!!!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to get rid of decimal point?

Hi, I have input with decimal point ( 9.99 ) for hours variable hrs. I need to change it to seconds. Here is my code: secs=`/usr/ucb/echo $hrs*3600 |bc` But I don't want to see the decimal point. I can use awk to trim it if there is one. I am just wondering if there is better standard... (2 Replies)
Discussion started by: cin2000
2 Replies

2. Shell Programming and Scripting

Comparing two numbers with decimal point

How to compare two numbers with decimal points ? Is there a way in bash to do this? (33 Replies)
Discussion started by: kinny
33 Replies

3. Shell Programming and Scripting

Insert decimal point for numbers

Hi In Unix, I have a file with some numbers like : 45600 12345 I want to insert a decimal point for these numbers based on user input. If the input is 2, the numbers should be changed to 456.00 123.45 If the input is 3, the numbers should be changed to 45.600 12.345 Can... (2 Replies)
Discussion started by: yoursdivu
2 Replies

4. Shell Programming and Scripting

remove directories with two digits after decimal point

Hi everyone, I am new here and generally not experienced with linux. My question must be easy, but as for now I have no idea how to do it. I have lots of directories with numerical names, e.g. 50 50.1 50.12 etc. What I want is to leave directories with no or single digit after the decimal... (2 Replies)
Discussion started by: cabaciucia
2 Replies

5. Shell Programming and Scripting

awk decimal point numbers matching

Hi All, Can some one help me in identifying the significance of character "$" ,Which is playing critical role in matching decimal point numbers as below. $ echo "01#.01"|awk '{if ($0 ~ /^+(\.*)?$/) print}' $ echo "01#.01"|awk '{if ($0 ~ /^+(\.*)?/) print}' 01#.01 $ Regards, Rmkganesh. (3 Replies)
Discussion started by: rmkganesh
3 Replies

6. Shell Programming and Scripting

Help with Round Up with 2 decimal point at specific column

Input file: USA 20.5683 UK 3.54221 Japan 2.54001 China 2.50897 Germany 2.05816 . . Desired output file: USA 20.57 UK 3.54 Japan 2.54 China 2.51 Germany 2.06 . . (2 Replies)
Discussion started by: perl_beginner
2 Replies

7. Shell Programming and Scripting

Moving decimal point in a series of numbers

Hi, i need to move the decimal point from a file listing some numbers like this : 49899.50 49914.55 49894.48 49939.65 49879.44 49919.57 49934.62 49944.67 49954.72 (1 Reply)
Discussion started by: Board27
1 Replies

8. Shell Programming and Scripting

Add Delimiter after 2 decimal point for a particular column

Hi All, Please help for the following scenario where I want to add a delimiter after 2 decimal point integer. Original Line 1007937820§L§2016-12-19§000000002§2018-02-01§2050-12-01§00395§M§146713.57§00005.05000§762.59§00395§M§301223.0528§1165§2017-03-31 20:34:25 Expected Line... (12 Replies)
Discussion started by: ckwan123
12 Replies

9. UNIX for Beginners Questions & Answers

How to add following decimal point to a CSV value?

hi there I being trying to figure out way to add " .0" to an integer value in a csv using sed or awk with out success. just as a work around for 2147483647 32 bit limitation that influxdb is currently having the data base will accept values and work fine if it has the XXX.0 ... (7 Replies)
Discussion started by: sash99
7 Replies

10. UNIX for Advanced & Expert Users

Convert a numeric to 2 decimal point value

Hi , I have a file which contains text like A|Mau|Code|12|Detail B|Mau|Code|20|Header I want to write a command using awk which will output A|Mau|Code|12.00|Detail B|Mau|Code|20.00|Header I used a command like awk -F"|" {printf "%s|%s|%s|%.2f|%s",$1,$2,$3,$4,$5}' which does the... (4 Replies)
Discussion started by: LoneRanger
4 Replies
MTKBABEL(1)						      General Commands Manual						       MTKBABEL(1)

NAME
mtkbabel - Tool for managing GPS data loggers based on the MTK chip SYNOPSIS
mtkbabel [-abcdEfhiIlmopRrstvwx] DESCRIPTION
mtkbabel is a command line program to operate GPS data loggers based on the MediaTek MTK chip. It was tested on the i-Blue 747, Qstarz BT- Q1000 and on the Holux M-241, it should work also with other GPS devices based on the same chip. The main features are: - Command line interface - Save data log in GPX and raw binary format - If required retrieve all the data, also the old one being overlapped - Change logging criteria: time, distance, speed - Change log format - START/STOP logging - Set OVERLAP or STOP method on memory full - Erase the internal memory USAGE
In order to use mtkbabel, please follow these instructions: 1. Attach the GPS data logger device to your computer via USB. 2. Now you have to switch the GPS device (at least the i-Blue 747) into LOG or NAV mode, otherwise the device will not be powered on, and no connection will be possible. Beware that in NAV mode the device goes into sleep mode if not connected to any Bluetooth device. 3. In order to use mtkbabel you have to either be root (not recommended) and/or you must have read/write permissions for the USB device file, usually /dev/ttyUSB0. This device usually has permissions 'crw-rw---- 1 root dialout', so you can either add your user to the dialout group (in this example) by doing $ adduser USERNAME dialout or (not recommended) make the device world-readable/-writable by doing: $ chmod 666 /dev/ttyUSB0 Another option is to write a udev rules file to change the owner and permissions of /dev/ttyUSB0 according to your requirements. 4. You can now run mtkbabel. For example, if you want to download the track log and the list of waypoints you captured on the device, run: $ mtkbabel -s 115200 -l off -f foo -w -t The default speed of 115200 baud should work in most cases and you can omit it, for the Holux M-241 you must use 38400 instead. This will turn off the autolog function, which is always turned on when you switch on the device. The track log will be in the file foo_trk.gpx, the waypoints in the file foo_wpt.gpx (both in GPX format). The file foo.bin will contain the binary log file. Downloading the data from the GPS device can take several minutes, depending on how much data has to be transferred. In order to delete all data from the GPS device, run: $ mtkbabel -s 115200 -E OPTIONS
-a Read all the log memory (overlapped data). -b filename.bin Do not read data from a GPS device, but rather read a previously saved .bin file. Ignore -f option. -c Create a GPX file with both tracks and waypoints. -d debug_level Debug level: 0..7. -E Erase data log memory. -f Base name for saved files (.bin and .gpx). If you, for example, use -f gpslog, mtkbabel will create files which are called gpslog.gpx, gpslog_trk.gpx, gpslog_wpt.gpx and gpslog.bin. -h Show a help text and exit. -i Ignore some error conditions and try to extract as much data as possible from GPS. -I Same as -i, but also write bad records into the GPX file. -l {on|off} Turn logging ON/OFF. -m {stop|overlap} Set STOP/OVERLAP recording method on memory full. -o log_format Enable or disable log fields (FIELD1,-FIELD2,...), available fields: UTC, VALID, LATITUDE, LONGITUDE, HEIGHT, SPEED, HEADING, DSTA, DAGE, PDOP, HDOP, VDOP, NSAT, SID, ELEVATION, AZIMUTH, SNR, RCR, MILLISECOND, DISTANCE. -p port Communication port, default: /dev/ttyUSB0. -R Recover from disabled log: erase data and reset recording criteria. -r time:distance:speed Set logging criteria (zero to disable): every 0.10-9999999.90 seconds, every 0.10-9999999.90 meters, over 0.10-9999999.90 km/h. Not all the devices support such wide ranges, more reasonable values are 1-999 seconds, 10-9999 meters and 10-999 km/h. -s speed Serial port speed, default 115200 baud. -t Create a GPX file with tracks. -v Show version information and exit. -w Create a GPX file with waypoints. -x Force reading Holux format. This is required to read-back the binary data produced by some Holux devices, which do not embed into the data itself the Holux identifier string. BUGS
Please report any bugs to Niccolo Rigacci <niccolo@rigacci.org>. LICENCE
mtkbabel is covered by the GNU General Public License (GPL), version 2 or later. AUTHORS
Niccolo Rigacci <niccolo@rigacci.org> This manual page was written by Uwe Hermann <uwe@hermann-uwe.de>. It is licensed under the terms of the GNU GPL (version 2 or later). July 30, 2011 MTKBABEL(1)
All times are GMT -4. The time now is 04:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy