Parse a single line file and store value.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Parse a single line file and store value.
# 8  
Old 02-24-2012
That is because only integer expressions can be use in test statements in any shell other than ksh93. Did you try earlier this suggestion?
Code:
if [ ${var2%%.*} -gt 6 ]; then

Code:
$ echo $var2
6.1
$ echo ${var2%%.*}
6

Otherwise you could use the utility bc ..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse for 2 numbers in large single line

Hi All, I am writing a script in which I need to gather 2 numbers for 'total' and 'successful'. The goal is to compare the two numbers and if they are not equal, rerun the task until all are successful. I'm thinking the best way will be with awk or sed, but I really don't know where to begin... (8 Replies)
Discussion started by: hburnswell
8 Replies

2. Shell Programming and Scripting

Need to parse the multiple definitions from a single line and assign

Hi, I need a help on my requirement that eg: NEED="TEST=Name WORK=Ps DEL=let" Here the definition can be n number, could anybody have an idea to get the output as, TEST=Name WORK=Ps DEL=let .. .. till the 'n' definitions listed. Any suggestions please..... Regards, ricky (6 Replies)
Discussion started by: ricky-row
6 Replies

3. UNIX for Dummies Questions & Answers

To find and display the middle line in a file using single line command.

Hi all, How can i display the middle line of a file using a single line command? (6 Replies)
Discussion started by: Lakme Pemmaiah
6 Replies

4. Shell Programming and Scripting

How to store the file name in a single line??

hi, i have a variable, in which i am storing the file names that are present in the current directory. $ls -1 s1.txt s2.txt s3.txt $FILES=`ls -ltr | grep "^-" | awk '{print $NF}'` $echo $FILES s1.txt s2.txt s3.txt i want to store the files names in a single line in the variable... (7 Replies)
Discussion started by: Little
7 Replies

5. Shell Programming and Scripting

Execute sequential files and store data in single file

1)In a particualr path i have a set of inputfiles like path:/defaultmis/MonthlyLoads/INFA_EXPORT_022013/map* example: 1)map_de 2)map_cod 3)map_feg ........and so on in above path there wil be nearly 15 to 20 files starting with map and in other path i have another file input file... (4 Replies)
Discussion started by: katakamvivek
4 Replies

6. Shell Programming and Scripting

How to read a file line by line and store it in a variable to execute a program ?

Hello, I am quite new in shell scripting and I would like to write a little scritp to run a program on some parameters files. all my parameters files are in the same directory, so pick them up with ls *.para >>dirafter that I have a dir file like that: param1.para param2.para etc... I... (2 Replies)
Discussion started by: shadok
2 Replies

7. Shell Programming and Scripting

Parse config file and store the values in variables

Hi, I have a config file that has blank, commented lines. I need to escape commented lines, blank lines, parse the remaining lines and store them in variables or array. the config file contains the following lines. # config file # Define Oracle User ORA_USER=abcde ORA_PASS=xyzabc... (8 Replies)
Discussion started by: Lakshmi Chowdam
8 Replies

8. Shell Programming and Scripting

Parse text file in shell & store to variable

Hi, I need to parse a simple text file like below and store the word that starts with BR* to a variable say $BRno. I need to do this in sh script. NOTE: the length of the numbers following BR is in constant. And there is only 1 BRXXX in a file at a given time. .txt file: BR276828... (1 Reply)
Discussion started by: script2010
1 Replies

9. UNIX for Advanced & Expert Users

how do you parse 1 line at a time of file1 ie. line(n) each line into new file

File 1 <html>ta da....unique file name I want to give file=>343...</html> <html>da ta 234 </html> <html>pa da 542 </html> and so on... File 2 343 234 542 and so on, each line in File 1 one also corresponds with each line in File 2 I have tried several grep, sed, while .. read, do,... (4 Replies)
Discussion started by: web_developer
4 Replies

10. Shell Programming and Scripting

store the first line of a file in a variable

i have to store the files in a folder and assign a variable to the the files. (0 Replies)
Discussion started by: dineshr85
0 Replies
Login or Register to Ask a Question
HTML::Parse(3)						User Contributed Perl Documentation					    HTML::Parse(3)

NAME
HTML::Parse - Deprecated, a wrapper around HTML::TreeBuilder SYNOPSIS
See the documentation for HTML::TreeBuilder DESCRIPTION
Disclaimer: This module is provided only for backwards compatibility with earlier versions of this library. New code should not use this module, and should really use the HTML::Parser and HTML::TreeBuilder modules directly, instead. The "HTML::Parse" module provides functions to parse HTML documents. There are two functions exported by this module: parse_html($html) or parse_html($html, $obj) This function is really just a synonym for $obj->parse($html) and $obj is assumed to be a subclass of "HTML::Parser". Refer to HTML::Parser for more documentation. If $obj is not specified, the $obj will default to an internally created new "HTML::TreeBuilder" object configured with strict_comment() turned on. That class implements a parser that builds (and is) a HTML syntax tree with HTML::Element objects as nodes. The return value from parse_html() is $obj. parse_htmlfile($file, [$obj]) Same as parse_html(), but pulls the HTML to parse, from the named file. Returns "undef" if the file could not be opened, or $obj otherwise. When a "HTML::TreeBuilder" object is created, the following variables control how parsing takes place: $HTML::Parse::IMPLICIT_TAGS Setting this variable to true will instruct the parser to try to deduce implicit elements and implicit end tags. If this variable is false you get a parse tree that just reflects the text as it stands. Might be useful for quick & dirty parsing. Default is true. Implicit elements have the implicit() attribute set. $HTML::Parse::IGNORE_UNKNOWN This variable contols whether unknow tags should be represented as elements in the parse tree. Default is true. $HTML::Parse::IGNORE_TEXT Do not represent the text content of elements. This saves space if all you want is to examine the structure of the document. Default is false. $HTML::Parse::WARN Call warn() with an apropriate message for syntax errors. Default is false. REMEMBER! HTML::TreeBuilder objects should be explicitly destroyed when you're finished with them. See HTML::TreeBuilder. SEE ALSO
HTML::Parser, HTML::TreeBuilder, HTML::Element COPYRIGHT
Copyright 1995-1998 Gisle Aas, 1999-2004 Sean M. Burke, 2005 Andy Lester, 2006 Pete Krawczyk. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. AUTHOR
Currently maintained by Pete Krawczyk "<petek@cpan.org>" Original authors: Gisle Aas, Sean Burke and Andy Lester. perl v5.12.1 2006-08-06 HTML::Parse(3)