07-21-2009
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 entered
could anyone give me a few pointers to the commans/systax i will need to use for each check?
also any idea if any of them can be combined?
any pointers welcome...
thanks
skinnygav
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Is there a command that sets a variable length?
I have a input of a variable length field but my output for that field needs to be set to 32 char.
Is there such a command?
I am on a sun box running ksh
Thanks (2 Replies)
Discussion started by: r1500
2 Replies
2. Shell Programming and Scripting
I am using a Korn Shell script..
I need to verify the length of a variable..
ie number=12345
I need then to check 12345 to make sure its no longer than 5 digits...
Can you help? (4 Replies)
Discussion started by: frustrated1
4 Replies
3. UNIX for Dummies Questions & Answers
Hi ,
I have a script wherein i have a For Loop.
Within this for loop i create a variable and assign it a value.
The script goes to a For Loop only if certain conditions are met , which means the variable may or may not exists.
However down the line in the script i have to check if that... (2 Replies)
Discussion started by: samit_9999
2 Replies
4. Shell Programming and Scripting
Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types:
(H)eader Records
(D)etail Records
(T)railer Records
The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
Hi All,
I want to check existence of variable, whose name gets decided dynamically.
E.g. value of this variable,is derived as $option_"exclude" , where value of option varies depending upon user input.
I am trying to do it in a following way :
set exclude_var = `echo $option"_exclude"`... (3 Replies)
Discussion started by: Rashmee
3 Replies
8. Shell Programming and Scripting
hello,
i have a variable which should have following content :
var="value1"
or
var="value2"
or
var="value2:*" # example: value2:22
how can i check :
- if the content is ok (value1 / value2* )
- the two options of "value2"
when content is example "value2:22" , i want to split... (3 Replies)
Discussion started by: bora99
3 Replies
9. Shell Programming and Scripting
Hi,
I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string.
But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields.
For ex:
Say my line... (9 Replies)
Discussion started by: rashmisb
9 Replies
10. Shell Programming and Scripting
Hi Team,
I have an issue to split the file which is having special chracter(German Char) using awk command.
I have a different length records in a file. I am separating the files based on the length using awk command.
The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies
LEARN ABOUT HPUX
fscat_vxfs
fscat_vxfs(1M) fscat_vxfs(1M)
NAME
fscat_vxfs: fscat - cat a VxFS file system
SYNOPSIS
output-file] offset] length] block_size] special
DESCRIPTION
provides an interface to a VxFS snapshot file system, similar to that provided by invoked on the block or character special file of regular
VxFS file systems. works when executed on the special device of any VxFS file system.
On most VxFS file systems, the block or character special file for the file system provides access to a raw image of the file system to
back up the file system to tape. On a snapshot file system, access to the corresponding block or character special file provides little
useful information. provides a stream of bytes representing the file system snapshot. This datastream is written by default to standard
output, although the output-file option can be used to specify another destination. The datastream on standard output can be processed
several ways, such as in a pipeline, or written to a tape.
By default, the output is a stream of bytes that starts at the beginning of the file system and continues to the last byte. On a snapshot
file system, data is read from the file system using special ioctls on the mount point. On other VxFS file systems, data is read from the
specified special file. Unless otherwise specified, data is written to standard output.
All numbers entered as option arguments can have as a prefix to indicate octal, or as a prefix to indicate hexadecimal. A or can be
appended to indicate the value is in 512-byte blocks, a or to indicate the value is in kilobytes, an or to indicate the value is in
megabytes, or a or to indicate the value is in gigabytes. An appended letter can be separated from the number by a space, in which case
the letter and number should be enclosed in a set of quotes. For example:
All numbers entered as options must be in multiples of 512 bytes. For example, a value of 5713 as an offset is rejected.
Options
recognizes the following options:
Specify the output block size, in bytes.
block_size must be less than or equal to 1 megabyte.
Specify the VxFS file system type.
Specify an output file in which to write the datastream.
Specify the transfer length, in bytes.
A length of includes the remainder of the file system after the specified offset.
Specify the starting offset in bytes.
Operands
recognizes the following operand:
special Name of the special device from which the VxFS file system is accessed.
Notes
Snapshot file systems are only available with the HP OnLineJFS product.
A snapshot file system cannot be written to.
A snapshot file system exists only as long as it is mounted; once unmounted, the special file no longer contains a snapshot file system.
When is run on a mounted VxFS snapshot, the content of free blocks (that is, blocks not allocated to any file or metadata) is undefined.
The content of free blocks can change after additional data is written to the primary file system, but blocks associated with files always
display the content they had when the snapshot was created.
does not work with Storage Checkpoints.
SEE ALSO
dd(1), fs_vxfs(4), vxfsio(7).
fscat_vxfs(1M)