Sponsored Content
Top Forums UNIX for Dummies Questions & Answers converting string to number in shell script Post 302600848 by balajesuri on Wednesday 22nd of February 2012 08:57:15 AM
Old 02-22-2012
Code:
#!/bin/bash
timeTot=0
timeTmp=$(grep 'Run time' input | cut -c36-39)
timeTot=`echo "$timeTot + $timeTmp" | bc`
echo "total RunTime=" $timeTot

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell to number and to string

Hello Does the unix korn shell provide a function to convert between number and string data-types regards Hrishy (1 Reply)
Discussion started by: xiamin
1 Replies

2. Shell Programming and Scripting

need help converting string to number for calculation

I've searched the forum and google, but can't see an answer to this simple problem. Here's my small test script: #!/bin/csh echo "enter a number:" read num echo "you entered $num" set num = `expr $num + 1` echo new value is $num can someone show me how to do this calculation? note that... (4 Replies)
Discussion started by: tpatput
4 Replies

3. Shell Programming and Scripting

Converting Shell Script to HTML

Hi, Im new to shell scripting. My task is to convert shell script feed into html, so basically I have a lot of information in shell script and I want to convert it html. I know you can simply convert the information by hand, but is there any simpler way? Thank you Dave (3 Replies)
Discussion started by: davwel
3 Replies

4. Shell Programming and Scripting

Problem in converting number in shell script

Hi All, I am writing a shell script in which I want to convert a number like : Suppose the number is "98487657" and we have to convert it to "98000000", what I want to do is to retain first 2 digits and convert all remaining digits to "0". Number could be of any length (length... (4 Replies)
Discussion started by: amitanshu.verma
4 Replies

5. Shell Programming and Scripting

How to Check given string is number in shell script?

Hi, Can anyone help me out to check whether the input argument is number? Example: REQUEST_ID="123456" I need to check the REQUEST_ID value is number or string. Thanks in Advance Regards BS (6 Replies)
Discussion started by: balajiora
6 Replies

6. Shell Programming and Scripting

Shell Script to identify the line number containing a particular "string"

Hi, I have a log file, where i am required to identify the line number, where a particular string/line appears in the log file. And then copy 200 lines above that line number to a new file. Can someone provide pointers on how to write this script or what command to be used ? Any... (2 Replies)
Discussion started by: kk2202
2 Replies

7. Shell Programming and Scripting

Unix shell script converting temperatures.

:confused:Please I really need help with an assignment question. I need to write a script that will take the input from a file and convert the number from Centigrade(Celcius) to Fahrenheit or vice versa. Thank you so much. I really need it to be detailed. Please remember the input comes from a file. (1 Reply)
Discussion started by: starter101
1 Replies

8. Shell Programming and Scripting

Converting rows to columns using shell script

I have a script which converts rows to columns. file_name=$1 mailid=$2 #CREATE BACKUP OF ORIGINAL FILE #cp ${file_name}.xlsx ${file_name}_temp.xlsx #tr '\t' '|' < ${file_name}_temp.xlsx > ${file_name}_temp.csv #rm ${file_name}_temp.xlsx pivot_row=`head -1 ${file_name}` sed 1d... (3 Replies)
Discussion started by: andy538
3 Replies

9. Shell Programming and Scripting

Converting a shell script to program

Hi I am new in programming. I have written a shell code, but i want to secure my code. I have tried SHC. It is converting it to binary, but can be converted in plain text again by core dump. I have tried to convert it in rpm by "rpmbuild -bb my.spec" option but the result is same. ... (4 Replies)
Discussion started by: Priy
4 Replies

10. UNIX for Beginners Questions & Answers

Concatenate a string and number and compare that with another string in awk script

I have below code inside my awk script if ( $0 ~ /SVC IN:/ ) { svc_in=substr( $0,23 , 3); if (msg_start == 1 && msg_end == 0) { msg_arr=$0; } } else if ( $0 ~ /^SVC OUT:/ ) { svc_out=substr( $0, 9, 3); if (msg_start == 1 && msg_end == 0) ... (6 Replies)
Discussion started by: bhagya123
6 Replies
QwtPlotLayout(3)						 Qwt User's Guide						  QwtPlotLayout(3)

NAME
QwtPlotLayout - Layout engine for QwtPlot. SYNOPSIS
#include <qwt_plot_layout.h> Public Types enum Options { AlignScales = 1, IgnoreScrollbars = 2, IgnoreFrames = 4, IgnoreMargin = 8, IgnoreLegend = 16 } Public Member Functions virtual void activate (const QwtPlot *, const QRect &rect, int options=0) bool alignCanvasToScales () const int canvasMargin (int axis) const const QRect & canvasRect () const virtual void invalidate () QwtPlot::LegendPosition legendPosition () const double legendRatio () const const QRect & legendRect () const int margin () const virtual QSize minimumSizeHint (const QwtPlot *) const QwtPlotLayout () const QRect & scaleRect (int axis) const void setAlignCanvasToScales (bool) void setCanvasMargin (int margin, int axis=-1) void setLegendPosition (QwtPlot::LegendPosition pos, double ratio) void setLegendPosition (QwtPlot::LegendPosition pos) void setLegendRatio (double ratio) void setMargin (int) void setSpacing (int) int spacing () const const QRect & titleRect () const virtual ~QwtPlotLayout () Protected Member Functions QRect alignLegend (const QRect &canvasRect, const QRect &legendRect) const void alignScales (int options, QRect &canvasRect, QRect scaleRect[QwtPlot::axisCnt]) const void expandLineBreaks (int options, const QRect &rect, int &dimTitle, int dimAxes[QwtPlot::axisCnt]) const QRect layoutLegend (int options, const QRect &) const Detailed Description Layout engine for QwtPlot. It is used by the QwtPlot widget to organize its internal widgets or by QwtPlot::print() to render its content to a QPaintDevice like a QPrinter, QPixmap/QImage or QSvgRenderer. Member Enumeration Documentation enum QwtPlotLayout::Options Options to configure the plot layout engine o AlignScales Unused o IgnoreScrollbars Ignore the dimension of the scrollbars. There are no scrollbars, when the plot is rendered to a paint device (QwtPlot::print() ). o IgnoreFrames Ignore all frames. QwtPlot::print() doesn't paint them. o IgnoreMargin Ignore the margin(). o IgnoreLegend Ignore the legend. See also: activate() Constructor &; Destructor Documentation QwtPlotLayout::QwtPlotLayout () [explicit] Constructor. QwtPlotLayout::~QwtPlotLayout () [virtual] Destructor. Member Function Documentation void QwtPlotLayout::activate (const QwtPlot *plot, const QRect &plotRect, intoptions = 0) [virtual] Recalculate the geometry of all components. Parameters: plot Plot to be layout plotRect Rect where to place the components options Options See also: invalidate(), Options, titleRect(), legendRect(), scaleRect(), canvasRect() bool QwtPlotLayout::alignCanvasToScales () const Return the align-canvas-to-axis-scales setting. The canvas may: o extend beyond the axis scale ends to maximize its size o align with the axis scale ends to control its size. Returns: align-canvas-to-axis-scales setting See also: setAlignCanvasToScales, setCanvasMargin() Note: In this context the term 'scale' means the backbone of a scale. QRect QwtPlotLayout::alignLegend (const QRect &canvasRect, const QRect &legendRect) const [protected] Align the legend to the canvas Parameters: canvasRect Geometry of the canvas legendRect Maximum geometry for the legend Returns: Geometry for the aligned legend void QwtPlotLayout::alignScales (intoptions, QRect &canvasRect, QRectscaleRect[QwtPlot::axisCnt]) const [protected] Align the ticks of the axis to the canvas borders using the empty corners. See also: Options int QwtPlotLayout::canvasMargin (intaxis) const Returns: Margin around the scale tick borders See also: setCanvasMargin() const QRect & QwtPlotLayout::canvasRect () const Returns: Geometry for the canvas See also: activate(), invalidate() void QwtPlotLayout::expandLineBreaks (intoptions, const QRect &rect, int &dimTitle, intdimAxis[QwtPlot::axisCnt]) const [protected] Expand all line breaks in text labels, and calculate the height of their widgets in orientation of the text. Parameters: options Options how to layout the legend rect Bounding rect for title, axes and canvas. dimTitle Expanded height of the title widget dimAxis Expanded heights of the axis in axis orientation. See also: Options void QwtPlotLayout::invalidate () [virtual] Invalidate the geometry of all components. See also: activate() QRect QwtPlotLayout::layoutLegend (intoptions, const QRect &rect) const [protected] Find the geometry for the legend Parameters: options Options how to layout the legend rect Rectangle where to place the legend Returns: Geometry for the legend See also: Options QwtPlot::LegendPosition QwtPlotLayout::legendPosition () const Returns: Position of the legend See also: setLegendPosition(), QwtPlot::setLegendPosition(), QwtPlot::legendPosition() double QwtPlotLayout::legendRatio () const Returns: The relative size of the legend in the plot. See also: setLegendPosition() const QRect & QwtPlotLayout::legendRect () const Returns: Geometry for the legend See also: activate(), invalidate() int QwtPlotLayout::margin () const Returns: margin See also: setMargin(), spacing(), QwtPlot::margin() QSize QwtPlotLayout::minimumSizeHint (const QwtPlot *plot) const [virtual] Return a minimum size hint. See also: QwtPlot::minimumSizeHint() const QRect & QwtPlotLayout::scaleRect (intaxis) const Parameters: axis Axis index Returns: Geometry for the scale See also: activate(), invalidate() void QwtPlotLayout::setAlignCanvasToScales (boolalignCanvasToScales) Change the align-canvas-to-axis-scales setting. The canvas may: o extend beyond the axis scale ends to maximize its size, o align with the axis scale ends to control its size. Parameters: alignCanvasToScales New align-canvas-to-axis-scales setting See also: setCanvasMargin() Note: In this context the term 'scale' means the backbone of a scale. Warning: In case of alignCanvasToScales == true canvasMargin will have no effect void QwtPlotLayout::setCanvasMargin (intmargin, intaxis = -1) Change a margin of the canvas. The margin is the space above/below the scale ticks. A negative margin will be set to -1, excluding the borders of the scales. Parameters: margin New margin axis One of QwtPlot::Axis. Specifies where the position of the margin. -1 means margin at all borders. See also: canvasMargin() Warning: The margin will have no effect when alignCanvasToScales is true void QwtPlotLayout::setLegendPosition (QwtPlot::LegendPositionpos, doubleratio) Specify the position of the legend. Parameters: pos The legend's position. ratio Ratio between legend and the bounding rect of title, canvas and axes. The legend will be shrinked if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5. See also: QwtPlot::setLegendPosition() void QwtPlotLayout::setLegendPosition (QwtPlot::LegendPositionpos) Specify the position of the legend. Parameters: pos The legend's position. Valid values are QwtPlot::LeftLegend, QwtPlot::RightLegend, QwtPlot::TopLegend, QwtPlot::BottomLegend. See also: QwtPlot::setLegendPosition() void QwtPlotLayout::setLegendRatio (doubleratio) Specify the relative size of the legend in the plot Parameters: ratio Ratio between legend and the bounding rect of title, canvas and axes. The legend will be shrinked if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5. void QwtPlotLayout::setMargin (intmargin) Change the margin of the plot. The margin is the space around all components. Parameters: margin new margin See also: margin(), setSpacing(), QwtPlot::setMargin() void QwtPlotLayout::setSpacing (intspacing) Change the spacing of the plot. The spacing is the distance between the plot components. Parameters: spacing new spacing See also: setMargin(), spacing() int QwtPlotLayout::spacing () const Returns: spacing See also: margin(), setSpacing() const QRect & QwtPlotLayout::titleRect () const Returns: Geometry for the title See also: activate(), invalidate() Author Generated automatically by Doxygen for Qwt User's Guide from the source code. Version 5.2.2 Mon Aug 1 2011 QwtPlotLayout(3)
All times are GMT -4. The time now is 04:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy