Sponsored Content
Top Forums Shell Programming and Scripting Substring based on delimiter, finding last delimiter Post 302378110 by tene on Monday 7th of December 2009 02:18:30 AM
Old 12-07-2009
Gaorav
Can you explain this?

if /^(.*)\-(.*)$/
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

split record based on delimiter

Hi, My inputfile contains field separaer is ^. 12^inms^ 13^fakdks^ssk^s3 23^avsd^ 13^fakdks^ssk^a4 I wanted to print only 2 delimiter occurence i.e 12^inms^ 23^avsd^ (4 Replies)
Discussion started by: Jairaj
4 Replies

2. UNIX for Dummies Questions & Answers

Trimming a string based on delimiter.

Hi, I have a string say "whateverCluster". I need everthing apart from the string "Cluster" Input: whateverCluster Desired output: whatever (5 Replies)
Discussion started by: mohtashims
5 Replies

3. Shell Programming and Scripting

How to cut by delimiter, and delimiter can be anything except numbers?

Hi all, I have a number of strings like below: //mnt/autocor/43°13'(33")W/ and i'm trying to get the numbers in this string, for example 431333 please help thanks ahead (14 Replies)
Discussion started by: sunnydanniel
14 Replies

4. Shell Programming and Scripting

Need help for finding correct delimiter

I've a series of words in the format "abc0001d" till "abc1999d". I would like to use delimiter to cut the word from abc0001s to two words: abc00 and 01d. Help me in finding the correct delimiter to cut in desired way. (7 Replies)
Discussion started by: surdileep
7 Replies

5. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

6. Shell Programming and Scripting

Finding delimiter

Hi, I need to find the field separator for the given files. Ex- abc.txt is "|" delimited file , when I give command the output should be "|" and that shud store it in another variable. This is same with csv files or any other delmited file. If I give the filename it shud give the... (1 Reply)
Discussion started by: Prashanth B
1 Replies

7. Shell Programming and Scripting

Perl Code to change file delimiter (passed as argument) to bar delimiter

Hi, Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters. Any help would... (2 Replies)
Discussion started by: JPB1977
2 Replies

8. Shell Programming and Scripting

Separate string based on delimiter

Hi, for fd in $(grep "/tmp/" hello.properties)The grep gives me the below output: deploydir=/tmp/app1/dfol prodir= /tmp/hello/prop ...... Now i want to store /tmp/app1/dfol then /tmp/hello/prop in a variable so that i can check if those folders files exists or not. The delimiter would... (4 Replies)
Discussion started by: mohtashims
4 Replies

9. Shell Programming and Scripting

How to separate based on delimiter?

Hi, Variable=MKT1,MKT2,MKT3 and so on i am trying to seperate MKT1,MKT2,MKT3 and store each in a variable. the values in variable1 may vary. I am using bash (8 Replies)
Discussion started by: arghadeep adity
8 Replies

10. UNIX for Dummies Questions & Answers

Splitting strings based on delimiter

i have a snippet from server log delimited by forward slash. /a/b/c/d/filename i need to cut until last delimiter. So desired output should look like: /a/b/c/d can you please help? Thanks in advance. (7 Replies)
Discussion started by: alpha_1
7 Replies
priv_str_to_set(3)					     Library Functions Manual						priv_str_to_set(3)

NAME
priv_str_to_set(), priv_set_to_str() - privilege name to set conversion function SYNOPSIS
Parameters priv_list The list of privilege names, passed as a string, separated by one or more characters from delimiter. It may also contain the compound privileges (basic, basicroot, and policy). delimiter Separates the privileges in priv_list. index_ptr If an error occurs while parsing the list of privilege names, the pointer pointed to by index_ptr is set to point to the remainder of the string after the error occurred, so long as index_ptr is not a NULL pointer. delimiter Separates the individual privilege names by any of the specified characters. If delimiter is a NULL character, the default delimiter of comma is used. flag Bit mask with the following bit positions defined: Exactly one of the two flags must be passed. When flag is the resulting string uses the compound privileges and to arrive at a short representation. priv_vec Specifies privilege set. DESCRIPTION
priv_str_to_set Conversion converts a list of privilege names to a privilege set. priv_list is a string consisting of privilege names and/or compound privileges. The individual elements in the string are separated by one or more characters of delimiter . Any privilege in the list priv_list can be optionally preceded by an exclamation mark to be interpreted as removal. For example, means all privileges in the compound privilege except the privilege. The string is case-insensitive. prefix is optional to a privilege name. For example, and all have the same meaning. priv_list is interpreted left to right, so the string is the same as an empty list of privileges, while is the same as For a list of valid privileges (both individual privileges and compound privileges), see privileges(5). priv_set_to_str Conversion converts a privilege set to a string of privilege names separated by the character specified by delimiter . RETURN VALUE
and return the following values: pointer Successful completions. Returns a non-null pointer. The caller of is responsible for freeing the result using the The caller of is responsible for freeing the result using the NULL pointer Function failed. Returns a null pointer and sets to indicate the error . ERRORS
If any of the following conditions occur, the functions fail and set Cannot allocate enough memory for the given data. One or more arguments are invalid. EXAMPLES
#include <stdio.h> #include <sys/types.h> #include <sys/privileges.h> #define priv_list "PRIV_CHOWN,PRIV_CHROOT,PRIV_DACREAD" main() { char *index; priv_set_t * priv_vector; if ( (priv_vector = priv_str_to_set( priv_list, NULL, &index)) == NULL ) { perror("priv_str_to_set Failed"); if (index) printf("Invalid privilege name starting at %s ", index); exit(1); } printf("The privileges in the given privilege vector are %s ", priv_set_to_str( priv_vector, NULL, PRIV_STR_SHORT) ); } DEPENDENCIES
and are both part of the library. SEE ALSO
privset_free(3), privileges(5). priv_str_to_set(3)
All times are GMT -4. The time now is 08:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy