Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Extract string between two special chracters Post 303012024 by SIMMS7400 on Saturday 27th of January 2018 09:44:29 PM
Old 01-27-2018
Extract string between two special chracters

Hi Folks -

I'm trying to extract the string between two special characters, the "-" and "." symbols.

The string format is as such:
Code:
_PBCS_URL_PRD=https://plan-a503777.pbcs.us6.ocloud.com
_PBCS_URL_TST=https://pln-test-a503777.pbcs.us6.ocloud.com

In the above case, I need to extract "a503777".

Notice _PBCS_URL_TST has two "-" symbols.

I've tried the following with no success:

Code:
echo "${_PBCS_URL_PRD}" | sed -e 's/-\(.*\)./\1/g'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help to extract a string delimited by any special character

I have a string as follows IS*blahblah TED~blahblah etc. I want to list down only IS and TED Can someone help me? (24 Replies)
Discussion started by: kumariak
24 Replies

2. Shell Programming and Scripting

escape chracters

hi, how to echo \\ in unix ie echo the path \\dir1\dir2\\dir3 thanks, Sam (7 Replies)
Discussion started by: sam99
7 Replies

3. Shell Programming and Scripting

Add string after another string with special characters

Hello everyone, I'm writing a script to add a string to an XML file, right after a specified string that only occurs once in the file. For testing purposes I created a file 'testfile' that looks like this: 1 2 3 4 5 6 6 7 8 9 And this is the script as far as I've managed: ... (2 Replies)
Discussion started by: heliode
2 Replies

4. Shell Programming and Scripting

Perl Script Syntax to Extract Everything After Special Character

Hi, I am writing a Perl script that reads in many lines, if a line meets the criteria I want to edit, it. For example, the script will return the following example line... test=abc123 All I want to do is strip off the "test=" and just be left with the abc123. In my script I can easily... (3 Replies)
Discussion started by: edrichard
3 Replies

5. Shell Programming and Scripting

Search for string in a file and extract another string to a variable

Hi, guys. I have one question: I need to search for a string in a file, and then extract another string from the file and assign it to a variable. For example: the contents of the file (group) is below: ... ftp:x:23: mail:x:34 ... testing:x:2001 sales:x:2002 development:x:2003 ...... (6 Replies)
Discussion started by: daikeyang
6 Replies

6. UNIX for Dummies Questions & Answers

tailing a file which contains Control chracters

Hi. I have a log file which gets updated by a java process and it uses ASCII STX and ETX characters (i.e CTRL-B and CTRL-C characters) to demarcate each XML message logged. so the format of the file is something like STX XML_MESSAGE1 .. .. ETX STX XML_MESSAGE2 .. .. ETX each XML... (4 Replies)
Discussion started by: gregoryp
4 Replies

7. Shell Programming and Scripting

to extract string from main string and string comparison

continuing from my previous post, whose link is given below as a reference https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569 consider there is create table commands in a file for eg: CREATE TABLE `Blahblahblah` ( `id` int(11) NOT NULL... (2 Replies)
Discussion started by: vivek d r
2 Replies

8. Shell Programming and Scripting

Extract string between 2 special characters

Hi, I have a unix file with contents as below Line1: ABC MNN X$$QWERTY$$ JKL Line2: HELLO $$HOW$$ ARE $$YOU$$ DOING i want to extract the string between $$ and $$ ie i want the output as QWERTY HOW YOU i want those strings seperated by some character say | desired output is... (7 Replies)
Discussion started by: vinredmac
7 Replies

9. Shell Programming and Scripting

Search String and extract few lines under the searched string

Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed Bold letters are the stations . The whole file has multiple stations . Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

10. UNIX for Dummies Questions & Answers

Extract string between two special characters

Hi, I have a file that looks something like >1-18*anc... (12 Replies)
Discussion started by: jyu429
12 Replies
ICNS2PNG(1)							   User Commands						       ICNS2PNG(1)

NAME
icns2png - convert Mac OS icns files to png images SYNOPSIS
icns2png [-x|-l] [options] [file ... ] DESCRIPTION
icns2png extracts images from mac .icns files, and exports them to png format. OPTIONS
-l, --list List the contents of one or more icns images -x, --extract Extract one or more icons to png images -o, --output Where to place extracted files. If not specified, icons will be extracted to the same path as the source file. -d, --depth Sets the pixel depth of the icons to extract. (1,4,8,32) -s, --size Sets the width and height of the icons to extract. (16,48,etc) Sizes 16x12, 16x16, 32x32, 48x48, 128x128, etc. are also valid. -h, --help Displays this help message. -v, --version Displays the version information EXAMPLES
icns2png -x anicon.icns # Extract all icon found in anicon.icns icns2png -x -s 48 anicon.icns # Extract all 48x48 32-bit icons icns2png -x -s 32 -d 1 anicon.icns # Extract all 32x32 1-bit icons icns2png -l anicon.icns # Lists the icons contained in anicon.icns AUTHOR
Written by Mathew Eis COPYRIGHT
Copyright (C) 2001-2008 Mathew Eis This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. icns2png 1.5 March 2008 ICNS2PNG(1)
All times are GMT -4. The time now is 10:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy