Sponsored Content
Full Discussion: Parsing char string
Top Forums Shell Programming and Scripting Parsing char string Post 302222750 by aigles on Thursday 7th of August 2008 01:09:08 PM
Old 08-07-2008
Another Ways (get second char) :
Code:
echo '-Ort' | cut -c2  
expr substr '-Ort' 2 1

Jean-Pierre.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

string of 7 char length always...

Hi, I know, particular value in the variable should always be of lenth 7 , but the value that is present in thevariable might be of any no.of characters less than or equal to 7... if the no.of characters in the variable is less than 7, I want to add, zeroes at the starting of the field.. How can... (3 Replies)
Discussion started by: thanuman
3 Replies

2. Programming

replacing char with string

how we can replace char with a string example char *a="a.s" so finally what i ant to do raplace a with ant and s sree so in my array a i want to store the value as "ant.sree" thank u in advance (1 Reply)
Discussion started by: phani_sree
1 Replies

3. Shell Programming and Scripting

last char from a string

i have a script that reads a plain text file. (its a ksh, and i can use bash also) each line of the file is a fullpath of a file. that makes the list huge. i need to add a functionalitie to that script, i have to be able to add /usr/* or /usr/ and with that reference all the files and folders... (6 Replies)
Discussion started by: broli
6 Replies

4. Shell Programming and Scripting

how to get number char from a string

for example: i hav a string like : /rmsprd/arch01/rmsprd/rmsprdarch72736.log how I can extract my_num=72736? I know I can echo "/rmsprd/arch01/rmsprd/rmsprdarch72736.log" | tr "/" " " | awk '{ print $4 }' to get rmsprdarch72736.log (4 Replies)
Discussion started by: netbanker
4 Replies

5. Shell Programming and Scripting

Parsing X char from right to left

I am new to bash scripts I need something quite easy to do in VBS, When I wanted to get the first 5 chars I used funcition right(5,strGet) how can I do the same in bash? I am trying to get the MAC address in Ubuntu I have done so far ifconfig wlan2 | grep HWaddr | awk '{print $5}' | sed -e... (3 Replies)
Discussion started by: 4scriptmoni
3 Replies

6. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

7. Shell Programming and Scripting

How to loop through every char in a string

for example this string: gLZMQp8i Loop become easy if we add space between each char, How to do it? or other solutions are welcome. (9 Replies)
Discussion started by: honglus
9 Replies

8. Shell Programming and Scripting

Parsing a long string string problem for procmail

Hi everyone, I am working on fetchmail + procmail to filter mails and I am having problem with parsing a long line in the body of the email. Could anyone help me construct a reg exp for this string below. It needs to match exactly as this string. GetRyt... (4 Replies)
Discussion started by: cwiggler
4 Replies

9. Programming

C++ Using open on a string instead of char*

I am using ifstream to open a file using std::fstream::open void open ( const char * filename, ios_base::openmode mode = ios_base::in ); However I want to use a string instead of a char* as follows but having a problem on how to do this string val_ifmodl = “fred.modl” ifstream ifs_modl;... (2 Replies)
Discussion started by: kristinu
2 Replies

10. Shell Programming and Scripting

Parsing of Char and Numeric in a file

Hi All, i'm working on some report and currently have this plain text file generated. server_name1|sdfd1deal | 1048572| 1040952| 99| 207| 1| 1 server_name1|dba1dbs | 83886048| 40730796| 48| 5762| 22764| 8... (4 Replies)
Discussion started by: fedora132010
4 Replies
str_to_label(3TSOL)				       Trusted Extensions Library Functions				       str_to_label(3TSOL)

NAME
str_to_label - parse human readable strings to label SYNOPSIS
cc [flag...] file... -ltsol [library...] #include <tsol/label.h> int str_to_label(const char *string, m_label_t **label, const m_label_type_t label_type, uint_t flags, int *error); DESCRIPTION
The str_to_label() function is a simple function to parse human readable strings into labels of the requested type. The string argument is the string to parse. If string is the result of a label_to_str() conversion of type M_INTERNAL, flags are ignored, and any previously parsed label is replaced. If *label is NULL, str_to_label() allocates resources for label and initializes the label to the label_type that was requested before pars- ing string. If *label is not NULL, the label is a pointer to a mandatory label that is the result of a previously parsed label and label_type is ignored. The type that is used for parsing is derived from label for any type-sensitive operations. If flags is L_MODIFY_EXISTING, the parsed string can be used to modify this label. If flags is L_NO_CORRECTION, the previously parsed label is replaced and the parsing algorithm does not attempt to infer missing elements from string to compose a valid label. If flags is L_DEFAULT, the previously parsed label is replaced and the parsing algorithm makes a best effort to imply a valid label from the elements of string. The caller is responsible for freeing the allocated resources by calling the m_label_free() function. label_type defines the type for a newly allocated label. The label type can be: MAC_LABEL The string should be translated as a Mandatory Access Control (MAC) label. USER_CLEAR The string should be translated as a label that represents the least upper bound of the labels that the user is allowed to access. If error is NULL, do not return additional error information for EINVAL. The calling process must have mandatory read access to label and human readable string. Or the calling process must have the sys_trans_label privilege. The manifest constants ADMIN_HIGH and ADMIN_LOW are the human readable strings that correspond to the Trusted Extensions policy admin_high and admin_low label values. See labels(5). RETURN VALUES
Upon successful completion, the str_to_label() function returns 0. Otherwise, -1 is returned, errno is set to indicate the error, and error provides additional information for EINVAL. Otherwise, error is a zero-based index to the string parse failure point. ERRORS
The str_to_label() function will fail if: EINVAL Invalid parameter. M_BAD_STRING indicates that string could not be parsed. M_BAD_LABEL indicates that the label passed in was in error. ENOTSUP The system does not support label translations. ENOMEM The physical limits of the system are exceeded by size bytes of memory which cannot be allocated. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ |Standard |See below. | +-----------------------------+-----------------------------+ Parsing types that are relative to Defense Intelligence Agency (DIA) encodings schema are Standard. Standard is specified in label_encod- ings(4). SEE ALSO
label_to_str(3TSOL), libtsol(3LIB), m_label(3TSOL), label_encodings(4), attributes(5), labels(5) Validating the Label Request Against the Printer's Label Range in Solaris Trusted Extensions Developer's Guide WARNINGS
A number of the parsing rules rely on the DIA label encodings schema. The rules might not be valid for other label schemata. NOTES
The functionality described on this manual page is available only if the system is configured with Trusted Extensions. SunOS 5.11 20 Jul 2007 str_to_label(3TSOL)
All times are GMT -4. The time now is 08:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy