Sponsored Content
Operating Systems Solaris Extract substring from a string Post 302371069 by jadoo_c2 on Friday 13th of November 2009 09:36:57 AM
Old 11-13-2009
length of "string" is not fixed, it can contain any number of word like
"STD,CLASS,AGE,DEPT"
"STD,CLASS" etc
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command/script to extract a substring from a string

I have a long string "<ID type="Oid">{}</ID>" I need to extract "GigabitEthernet0/1" from the above string. How can it be done? :) (5 Replies)
Discussion started by: girisha
5 Replies

2. Shell Programming and Scripting

Using Awk in shell script to extract an index of a substring from a parent string

Hi All, I am new to this shell scripting world. Struck up with a problem, can anyone of you please pull me out of this. Requirement : Need to get the index of a substring from a parent string Eg : index("Sandy","dy") should return 4 or 3. My Approach : I used Awk function index to... (2 Replies)
Discussion started by: sandeepms17
2 Replies

3. Shell Programming and Scripting

Sed extract substring on (OS X)

On OS 10.4.11 I have filenames like: 670711 SA T2 v1-1_DS_EF.doc CT_670520 AM T1 v1-2_DS_EF.doc CT_670716 - 2 SA T4 v1-2_DS_EF.doc CT_670713 SA T3 v1-1_DS_EF.doc 670421 PA DYP1 v1-1_DS_EF.doc CT_670425 PA DYP2 v1-1_DS_EF.doc CT_670107 RA T3 v1-2_DS_EF.doc CT_670521 AM T2 v1-2_DS_EF.doc... (3 Replies)
Discussion started by: mlommel
3 Replies

4. Shell Programming and Scripting

Need Help... to extract the substring

> tnsping $TWO_TASK | grep HOST Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.10.212)(PORT = 1540)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = OMTST15))) I want to extract like this HOST = 10.12.10.212 PORT = 1540 SERVICE_NAME = OMTST15 I... (4 Replies)
Discussion started by: dashok.83
4 Replies

5. Shell Programming and Scripting

Extract a substring.

I have a shell script that uses wget to grab a bunch of html from a url. URL_DATA=`wget -qO - "$URL1"` I now have a string $URL_DATA that I need to pull a substring out of..say I had the following in my string <p><a href="/scooby/929011567.html">Dog pictures check them out! -</a><font... (3 Replies)
Discussion started by: shellpower
3 Replies

6. UNIX for Dummies Questions & Answers

Extract substring of unknown length from string

I have a string: hgLogOutput=" +0000 files: forum/web/hook-test.txt /forum/web/hook-test-2.txt description: test" and I want to extract the file names from it, they will always appear between the files: and the description:. I have worked out that I can do this: "$hgLogOutput" | awk '{... (2 Replies)
Discussion started by: klogger
2 Replies

7. Shell Programming and Scripting

Extract a string up to the first occurence of a substring

Hi, I'm a newbie to shell scripting and have searched the forum but couldn't find what i was looking for. Basically I have a list of filenames like... 123-fileone.txt I want to be able to extract the prefix up to the first '-'. So I'd end up with 123. I have attempted it using a pretty... (2 Replies)
Discussion started by: kirkg
2 Replies

8. Shell Programming and Scripting

How to extract a substring from a string

Hi, I have an input string say for example: ABC,DEF,IJK,LMN,...,XYZ The above string is comma delimited. Now I have to extract the last part after the comma i.e. XYZ. :b: (3 Replies)
Discussion started by: bghosh
3 Replies

9. Shell Programming and Scripting

Extract substring in a file

Hello, A question please. A have a file that contains a string. Ex: AAAABBCCCCCDDEEEEEEEEEEFF I'd want to recover 2 substrings, 'BB' and 'FF' and then leave them in a new file. Could anoyone help me please? Thanks in advance (3 Replies)
Discussion started by: nolo41
3 Replies

10. Shell Programming and Scripting

Extract a substring from a file

Hello, A question please. A have a file that contains a string. Ex: AAAABBCCCCCDDEEEEEEEEEEFF I'd want to recover 2 substrings, 'BB' and 'FF' and then leave them in a new file. From position 5, 2 caracters (ex:"BB") and from position 25, 2 caracters (ex:"FF") in a file. Could anoyone help me... (3 Replies)
Discussion started by: nolo41
3 Replies
Log::Message::Simple(3pm)				 Perl Programmers Reference Guide				 Log::Message::Simple(3pm)

NAME
Log::Message::Simple - Simplified interface to Log::Message SYNOPSIS
use Log::Message::Simple qw[msg error debug carp croak cluck confess]; use Log::Message::Simple qw[:STD :CARP]; ### standard reporting functionality msg( "Connecting to database", $verbose ); error( "Database connection failed: $@", $verbose ); debug( "Connection arguments were: $args", $debug ); ### standard carp functionality carp( "Wrong arguments passed: @_" ); croak( "Fatal: wrong arguments passed: @_" ); cluck( "Wrong arguments passed -- including stacktrace: @_" ); confess("Fatal: wrong arguments passed -- including stacktrace: @_" ); ### retrieve individual message my @stack = Log::Message::Simple->stack; my @stack = Log::Message::Simple->flush; ### retrieve the entire stack in printable form my $msgs = Log::Message::Simple->stack_as_string; my $trace = Log::Message::Simple->stack_as_string(1); ### redirect output local $Log::Message::Simple::MSG_FH = *STDERR; local $Log::Message::Simple::ERROR_FH = *STDERR; local $Log::Message::Simple::DEBUG_FH = *STDERR; ### force a stacktrace on error local $Log::Message::Simple::STACKTRACE_ON_ERROR = 1 DESCRIPTION
This module provides standardized logging facilities using the "Log::Message" module. FUNCTIONS
msg("message string" [,VERBOSE]) Records a message on the stack, and prints it to "STDOUT" (or actually $MSG_FH, see the "GLOBAL VARIABLES" section below), if the "VERBOSE" option is true. The "VERBOSE" option defaults to false. Exported by default, or using the ":STD" tag. debug("message string" [,VERBOSE]) Records a debug message on the stack, and prints it to "STDOUT" (or actually $DEBUG_FH, see the "GLOBAL VARIABLES" section below), if the "VERBOSE" option is true. The "VERBOSE" option defaults to false. Exported by default, or using the ":STD" tag. error("error string" [,VERBOSE]) Records an error on the stack, and prints it to "STDERR" (or actually $ERROR_FH, see the "GLOBAL VARIABLES" sections below), if the "VERBOSE" option is true. The "VERBOSE" options defaults to true. Exported by default, or using the ":STD" tag. carp(); Provides functionality equal to "Carp::carp()" while still logging to the stack. Exported by using the ":CARP" tag. croak(); Provides functionality equal to "Carp::croak()" while still logging to the stack. Exported by using the ":CARP" tag. confess(); Provides functionality equal to "Carp::confess()" while still logging to the stack. Exported by using the ":CARP" tag. cluck(); Provides functionality equal to "Carp::cluck()" while still logging to the stack. Exported by using the ":CARP" tag. CLASS METHODS
Log::Message::Simple->stack() Retrieves all the items on the stack. Since "Log::Message::Simple" is implemented using "Log::Message", consult its manpage for the function "retrieve" to see what is returned and how to use the items. Log::Message::Simple->stack_as_string([TRACE]) Returns the whole stack as a printable string. If the "TRACE" option is true all items are returned with "Carp::longmess" output, rather than just the message. "TRACE" defaults to false. Log::Message::Simple->flush() Removes all the items from the stack and returns them. Since "Log::Message::Simple" is implemented using "Log::Message", consult its manpage for the function "retrieve" to see what is returned and how to use the items. GLOBAL VARIABLES
$ERROR_FH This is the filehandle all the messages sent to "error()" are being printed. This defaults to *STDERR. $MSG_FH This is the filehandle all the messages sent to "msg()" are being printed. This default to *STDOUT. $DEBUG_FH This is the filehandle all the messages sent to "debug()" are being printed. This default to *STDOUT. $STACKTRACE_ON_ERROR If this option is set to "true", every call to "error()" will generate a stacktrace using "Carp::shortmess()". Defaults to "false" perl v5.18.2 2014-01-06 Log::Message::Simple(3pm)
All times are GMT -4. The time now is 02:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy