awk substr is just for pulling part of a string, and is not used for string testing, although the operands of substr, such as starting position and length, can involve string testing. For example, the substr operand for starting position could be an index function for locating a desired starting position using a pattern match.
Following is an example using awk to test for six digits. Unlike the expr command, which has an assumed beginning-of-line anchor, this pattern has to be anchored at the front. The ! means NOT, so if the input is not exactly six digits, it will exit with code 1, else code 0.
Okay I will let users input spaces as well :)
I am having a mental block. I have done a couple of searches but havent found anything that I understand (the likes of :alpha: and awk).
Basically I want to give the user an option to enter some text which will go down as a field within a flat... (3 Replies)
Hi! I'm using
echo $string | grep "" -c
to test in a script if a string is a number and it seems to work. But how can i find, for example, if a string is a four figures number ?
Thanks to all! (2 Replies)
This is the code:
while test 1 -eq 1
do
read a
$a
if test $a = stop
then
break
fi
done
I read a command on every loop an execute it.
I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test.
For example echo hello.
Now the... (1 Reply)
How do I test multiple words in a string test like below:
if ]
then
print "You entered $TBS name.\n"
else
print "You entered an incorrect response.\n"
fi
This test does not work. I have tried different syntax versions. How does this work? And is there a better way to do it?
... (10 Replies)
Hi there, I have a bunch of interface names like
e1000g0
nge1
dmfe3
I also have some that have longer (vlan tagged) names
like
e1000g123001
nge23003
e1000g999002
I need to determine whether the interface is one of the former or latter types and I would do that by seeing... (7 Replies)
Hi guys
I am performing a simple test for a blank string with the following code:
if ] ]] ; then
echo "Blanks are NOT a valid input "
return 1
fi
The above fails giving a syntax error message:
syntax error at line 142 : `=~' unexpected
I am in ksh88
is there... (2 Replies)
I want to find whether string values are available in a field of a file. Let it be any character other than number . I just want to know whether characters will be available in it . Please share a single step command for this without creating a shell script. (5 Replies)
Discussion started by: Sang
5 Replies
LEARN ABOUT DEBIAN
rdf::trine::serializer::turtle
RDF::Trine::Serializer::Turtle(3pm) User Contributed Perl Documentation RDF::Trine::Serializer::Turtle(3pm)NAME
RDF::Trine::Serializer::Turtle - Turtle Serializer
VERSION
This document describes RDF::Trine::Serializer::Turtle version 1.000
SYNOPSIS
use RDF::Trine::Serializer::Turtle;
my $serializer = RDF::Trine::Serializer::Turtle->new( namespaces => { ex => 'http://example/' } );
print $serializer->serialize_model_to_string($model);
DESCRIPTION
The RDF::Trine::Serializer::Turtle class provides an API for serializing RDF graphs to the Turtle syntax. XSD numeric types are serialized
as bare literals, and where possible the more concise syntax is used for rdf:Lists.
METHODS
Beyond the methods documented below, this class inherits methods from the RDF::Trine::Serializer class.
"new ( namespaces => \%namespaces, base_uri => $base_uri )"
Returns a new Turtle serializer object.
"serialize_model_to_file ( $fh, $model )"
Serializes the $model to Turtle, printing the results to the supplied filehandle "<$fh">.
"serialize_model_to_string ( $model )"
Serializes the $model to Turtle, returning the result as a string.
"serialize_iterator_to_file ( $file, $iter )"
Serializes the iterator to Turtle, printing the results to the supplied filehandle "<$fh">.
"serialize_iterator ( $sink, $iter )"
Serializes the iterator to Turtle, printing the results to the supplied sink object.
"serialize_iterator_to_string ( $iter )"
Serializes the iterator to Turtle, returning the result as a string.
"serialize_node ( $node )"
Returns a string containing the Turtle serialization of $node.
"node_as_concise_string"
Returns a string representation using common Turtle syntax shortcuts (e.g. for numeric literals).
BUGS
Please report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>.
SEE ALSO
<http://www.w3.org/TeamSubmission/turtle/>
AUTHOR
Gregory Todd Williams "<gwilliams@cpan.org>"
COPYRIGHT
Copyright (c) 2006-2012 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms
as Perl itself.
perl v5.14.2 2012-06-29 RDF::Trine::Serializer::Turtle(3pm)