Sponsored Content
Top Forums Shell Programming and Scripting korn shell: check the content of a string of a variable Post 302628591 by Scrutinizer on Monday 23rd of April 2012 06:22:28 PM
Old 04-23-2012
Might need to flip value2 and value2:[0-9][0-9] around

Code:
case $var in
    value1)             echo value1 ;;
    value2:[0-9][0-9]*) echo "part1=${var%%:*} part2=${var#*:}" ;;
    value2)             echo value2 ;;
    *)                  echo "Unknown format" >&2 ;;
esac

This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Compare the content of a variable with a string

Hello all: I'm new in Unix and here and I'am spanish so my english isn't so good to explain my doubt. Here it is. Very urgent: I need to compare the value of a variable with a string. Example is this. Imagine that the variable x1 contains the path and a file text and I need to compare... (2 Replies)
Discussion started by: robdai
2 Replies

2. Shell Programming and Scripting

compound variable in korn shell

in a text " Korn Shell Unix programming Manual 3° Edition" i have found this sintax to declare a compoud variable: variable=( fild1 (0 Replies)
Discussion started by: ZINGARO
0 Replies

3. Shell Programming and Scripting

compound variable in korn shell

in a text " Korn Shell Unix programming Manual 3° Edition" i have found this sintax to declare a compoud variable: variable=( fild1 fild1 ) but this sintax in ksh and sh (HP-UNIX) not work... why?? exist another solution for this type of variable ??? (5 Replies)
Discussion started by: ZINGARO
5 Replies

4. AIX

how to check the existence of a file during ftp using korn shell?

i can able to transfer a file from build server(AIX)to webserver using ksh through ftp.my query is to check the existence of file while transfering from one server to other .i.e i need some command or script that checks the existence of file with same name in both server,within ftp syntax. ... (1 Reply)
Discussion started by: karthikprasathk
1 Replies

5. AIX

how to check the existence of a file using korn shell?

we have tranferred an ear from local server to remote server using ftp.consider, we have an ear file named a.ear in remote server,again if we transfer the same file named a.ear from local server to remote server.we need the kshell to check the existence of the ear file in remote server,and if the... (3 Replies)
Discussion started by: karthikprasathk
3 Replies

6. UNIX for Dummies Questions & Answers

check length content existence of variable

hi guys, im learning so be gentle... i'm wanting to write a script to read in a customer number. in order that the code is robust i want to check 1) the length of the value entered (4 characters) 2) that all characters entered are numeric between the values 1 to 3 3) that a value is... (1 Reply)
Discussion started by: skinnygav
1 Replies

7. Shell Programming and Scripting

Bash : Check aphanumeric content in variable

Hello everyone, I'm trying the best way to implement a check on a variable ... in particular I need to assess the content of characters and numbers , I tried on various manuals bash scripting but I could not figure out how to do ... any help? (3 Replies)
Discussion started by: ionral
3 Replies

8. Shell Programming and Scripting

String parsing in Korn Shell

Hi everybody, I have a string stored in a variable called record: record="SNMPv2-SMI::ent.9.9.43.1.3.9.2 = Timeticks: (177330898) 20 days, 12:35:08.98" I want to write some regular expressions good for Korn Shell to extract the number between parenthesis, in this case 177330898, and put it in... (3 Replies)
Discussion started by: omoyne
3 Replies

9. Programming

How to refer to variable (korn shell)?

Hi I have the following block of code in korn shell and don't now how to refer to variable `print variable1.$dvd` ? --- integer dvd=4 integer number=0 while (( dvd!=0 )) do print "Iteracja numer : $dvd" print "$_" #it refers to $dvd var but want to refer... (3 Replies)
Discussion started by: presul
3 Replies

10. Shell Programming and Scripting

Can i use grep to check variable content correctnes?

I need to know if is possible to use grep to check content of a local variable, for eg. i use read index and i want to check if the index i read is in correct form, how do i do that i tried with grep but i get errors all the time dont know how to make it work.. thanks! (3 Replies)
Discussion started by: Goroner
3 Replies
HTML::Formatter(3)					User Contributed Perl Documentation					HTML::Formatter(3)

NAME
HTML::Formatter - Base class for HTML formatters SYNOPSIS
use HTML::FormatSomething; my $infile = "whatever.html"; my $outfile = "whatever.file"; open OUT, ">$outfile" or die "Can't write-open $outfile: $! Aborting"; binmode(OUT); print OUT HTML::FormatSomething->format_file( $infile, 'option1' => 'value1', 'option2' => 'value2', ... ); close(OUT); DESCRIPTION
HTML::Formatter is a base class for classes that take HTML and format it to some output format. When you take an object of such a base class and call "$formatter->format( $tree )" with an HTML::TreeBuilder (or HTML::Element) object, they return the HTML formatters are able to format a HTML syntax tree into various printable formats. Different formatters produce output for different output media. Common for all formatters are that they will return the formatted output when the format() method is called. The format() method takes a HTML::Element object (usually the HTML::TreeBuilder root object) as parameter. Here are the four main methods that this class provides: SomeClass->format_file( $filename, option1 => value1, option2 => value2, ... ) This returns a string consisting of the result of using the given class to format the given HTML file according to the given (optional) options. Internally it calls "SomeClass->new( ... )->format( ... )" on a new HTML::TreeBuilder object based on the given HTML file. SomeClass->format_string( $html_source, option1 => value1, option2 => value2, ... ) This returns a string consisting of the result of using the given class to format the given HTML source according to the given (optional) options. Internally it calls "SomeClass->new( ... )->format( ... )" on a new HTML::TreeBuilder object based on the given source. $formatter = SomeClass->new( option1 => value1, option2 => value2, ... ) This creates a new formatter object with the given options. $render_string = $formatter->format( $html_tree_object ) This renders the given HTML object accerting to the options set for $formatter. After you've used a particular formatter object to format a particular HTML tree object, you probably should not use either again. SEE ALSO
HTML::FormatText, HTML::FormatPS, HTML::FormatRTF HTML::TreeBuilder, HTML::Element, HTML::Tree COPYRIGHT
Copyright (c) 1995-2002 Gisle Aas, and 2002- Sean M. Burke. All rights reserved. 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
Current maintainer: Sean M. Burke <sburke@cpan.org> Original author: Gisle Aas <gisle@aas.no> perl v5.12.1 2004-06-02 HTML::Formatter(3)
All times are GMT -4. The time now is 04:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy