Sponsored Content
Full Discussion: String parse question
Top Forums Shell Programming and Scripting String parse question Post 302109558 by Perderabo on Tuesday 6th of March 2007 06:07:41 PM
Old 03-06-2007
One way:
Code:
$ cat string
#! /usr/bin/ksh

string="[1] private.enterprises.954.1.1.1.1.1.2618 \(OctetString\): U [2] private.enterprises.954.1.1.1.1.2.2618 \(OctetString\): 2618"
echo string = $string
string=${string#*: }
first=${string%% *}
second=${string##*: }
echo first = $first
echo second = $second
exit 0
$ ./string
string = [1] private.enterprises.954.1.1.1.1.1.2618 \(OctetString\): U [2] private.enterprises.954.1.1.1.1.2.2618 \(OctetString\): 2618
first = U
second = 2618

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to parse this string

I want to get filenames from the following input. How can I parse this in bash. input data ------------------------------------------------------------------- path=/aaa/bbb/filename1;/aaa/filename2;/aaa/bbb/ccc/ddd/filename3 -------------------------------------------------------------------... (13 Replies)
Discussion started by: hcliff
13 Replies

2. Shell Programming and Scripting

Parse String from a Variable

Hello, Is there a quick way to parse the values from a variable? The variable has the following sample input: TA= The values of the TA variable is not fixed/hardcoded Basically I need to get the IV_Test and PF_SAPP_FWK values. I created a script that first use sed to remove ,... (3 Replies)
Discussion started by: racbern
3 Replies

3. Shell Programming and Scripting

Parse String Using Sed

Hi, I am wondering if there's a simpler way to extract the second occurrence of a word enclosed in that matches my search criteria. Sample Input is as follows: Error installing feature - com.er.nms.cif.ist.NoMatchingUpgra Error installing feature -... (4 Replies)
Discussion started by: racbern
4 Replies

4. Shell Programming and Scripting

How to parse a string efficiently

I am new to the boards and to shell programming and have a requirement to name new files received with a unique sequence number. I need to look at a particular file pattern that exists and then to increment a sequence by 1 and write the new file. Example of file names and sequence # ... (4 Replies)
Discussion started by: sandiego_coder
4 Replies

5. UNIX for Dummies Questions & Answers

parse string with awk

Hi Guys, I spend half a day getting this to work with no luck, perhaps you guys can help.. I have a string from a file looking like this: module::name=test::type=generic_data::exec=snmpget.......::desc=A Little Test::interval=300 what I would like to split it, so I get a value for each... (3 Replies)
Discussion started by: hyber
3 Replies

6. Shell Programming and Scripting

How to parse a string into variables

I'm working in korn shell and have a variable which contains a string like: aa_yyyymmdd_bbb_ccc_ddd.abc. I want to treat the _ and . as delimiters and parse the string so I end up with 6 values in variables that I can manipulate. My original plan was to use var1=`echo $sting1 | cut -c1-c2` but... (9 Replies)
Discussion started by: aquimby
9 Replies

7. Shell Programming and Scripting

Parse string

Hi, I need to parse a string, check if there are periods and strip the string. For example i have the following domains and subdomains: mydomain.com, dev.mydomain.com I need to strip all periods so i have a string without periods or domain extensions: mydomain, devmydomain. I use this for... (12 Replies)
Discussion started by: ktm
12 Replies

8. Shell Programming and Scripting

Parse a string as a command

I've a problem parsing a string as a command: Consider script stefano.sh as following: #!/usr/bin/sh txtshell="./parser.sh /ews/MyEventHandler/data/handler/StopAndMail.php eventid=StopAndMail.MVIN.6300 lot_number=1122FXB facility=EWSF3 'mailto=prova.prova@nohost.com, prova.test@nohost.com'... (2 Replies)
Discussion started by: buonstefano
2 Replies

9. Shell Programming and Scripting

parse a mixed alphanumeric string from within a string

Hi, I would like to be able to parse out a substring matching a basic pattern, which is a character followed by 3 or 4 digits (for example S1234 out of a larger string). The main string would just be a filename, like Thisis__the FileName_S1234_ToParse.txt. The filename isn't fixed, but the... (2 Replies)
Discussion started by: keaneMB
2 Replies

10. Programming

Perl parse string

Hi Perl Guys I have another perl question I have the following code that i have written Getopt::Long::config(qw( permute bundling )); my $OPT = {}; GetOptions($OPT, qw( ver=s help|h )) or die "options parsing failed"; This will allow the user to do something like... (4 Replies)
Discussion started by: ab52
4 Replies
YAF_SESSION(3)								 1							    YAF_SESSION(3)

The Yaf_Session class

INTRODUCTION
CLASS SYNOPSIS
Yaf_Session Yaf_SessionIteratorArrayAccessCountable Properties o protectedstatic$_instance o protected$_session o protected$_started Methods o private void Yaf_Session::__clone (void ) o Yaf_Session::__construct (void ) o public void Yaf_Session::count (void ) o public void Yaf_Session::current (void ) o public void Yaf_Session::del (string $name) o public void Yaf_Session::__get (string $name) o publicstatic void Yaf_Session::getInstance (void ) o public void Yaf_Session::has (string $name) o public void Yaf_Session::__isset (string $name) o public void Yaf_Session::key (void ) o public void Yaf_Session::next (void ) o public void Yaf_Session::offsetExists (string $name) o public void Yaf_Session::offsetGet (string $name) o public void Yaf_Session::offsetSet (string $name, string $value) o public void Yaf_Session::offsetUnset (string $name) o public void Yaf_Session::rewind (void ) o public void Yaf_Session::__set (string $name, string $value) o private void Yaf_Session::__sleep (void ) o public void Yaf_Session::start (void ) o public void Yaf_Session::__unset (string $name) o public void Yaf_Session::valid (void ) o private void Yaf_Session::__wakeup (void ) PROPERTIES
o $_instance - o $_session - o $_started - PHP Documentation Group YAF_SESSION(3)
All times are GMT -4. The time now is 04:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy