Sponsored Content
Full Discussion: how to remove a substring
Top Forums Shell Programming and Scripting how to remove a substring Post 302336309 by samtekdallas on Tuesday 21st of July 2009 08:01:06 PM
Old 07-21-2009
Question how to remove a substring

I want to modify a string in shell script (/bin/sh). Could you please help me.

I have a variable which can store the values like below.
v10.5.2.1p001C_TN1
or v10.5.2.1p002_TN1

I have to search first whether ‘p' character exists into the string which is stored in a variable.. If yes, then I have to remove the “p001C” and “p002' correspondingly. I mean I have to remove the content from p and before _TN

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

substring

Hi, I have a value of a filepath in a variable DATAFILE with value as "customtop/gpsore37/gepspo/1.0/bin/ashoka.csv ". Now i want the value of last 4 charcters in to another variable. That is EXTENSION = .csv How can i do this in Shell scripting Thanks in advance Alla Kishore (8 Replies)
Discussion started by: alla.kishore
8 Replies

2. Shell Programming and Scripting

Substring HELP!

Hi, I am trying to do something which I thought was very simple but still being a beginner, has proved not to be. Input: val1 val2 val3 val4 val5 val6 . . . etc Desired Output: Every row in which value of val6 is a number starting with 0.0 or contains a capital E. The input... (2 Replies)
Discussion started by: awknerd
2 Replies

3. UNIX for Dummies Questions & Answers

Need help with substring

I need to check the occurrence of one string within another. code ******************** if ;then do something done ******************** Thanks (7 Replies)
Discussion started by: w020637
7 Replies

4. Shell Programming and Scripting

substring

I have a string '<Hi>abc</Hi>" How to print "abc" (6 Replies)
Discussion started by: sandy1028
6 Replies

5. UNIX for Dummies Questions & Answers

Getting Substring

Hi, I hav a string lets say aa.txt:bb:txt length of the string can vary.. I have to keep the token inside a array and the delimiter is : plz send me the code (2 Replies)
Discussion started by: Deekay.p
2 Replies

6. Shell Programming and Scripting

how to remove this substring?

Hello, I need to remove a substring from a string in a ksh script, the string is like this: LOCATION=+DATADG1/CMSPRD1/datafile/system.235.456721 or LOCATION=/u03/oradata/CMSPRD/SYSTEM.dbf I need to strip the last file name from that path, and get: +DATADG1/CMSPRD1/datafile or,... (8 Replies)
Discussion started by: seafan
8 Replies

7. Shell Programming and Scripting

Remove a substring from string

Good morning friends, how can i remove a string with linux scripting from a file? In specific i want to remove from a file all the tweet names and links eg @aerta and links such as http://dst.co/pIiu3i9c Thanx!!! (4 Replies)
Discussion started by: paladinaeon
4 Replies

8. Shell Programming and Scripting

Using sed, awk or perl to remove substring of all lines except the first

Greetings All, I would like to find all occurences of a pattern and delete a substring from the all matching lines EXCEPT the first. For example: 1234::group:user1,user2,user3,blah1,blah2,blah3 2222::othergroup:user9,user8 4444::othergroup2:user3,blah,blah,user1 1234::group3:user5,user1 ... (11 Replies)
Discussion started by: jacksolm
11 Replies

9. UNIX for Dummies Questions & Answers

Remove when substring meets condition

Hi Masters, I need to remove lines when date format is below certain date My file input 20140906|ALASKA|USASEL|TARPUNG|2014-03-01|82176614040|20|1 20140906|ALASKA|USATENG|CRUIEX|2014-08-01|81267079997|5|0 20140906|ALASKA|USASEL|CRUIEMBANG|2013-10-01|82280779814|9|0... (4 Replies)
Discussion started by: radius
4 Replies

10. Shell Programming and Scripting

Remove lines matching a substring in a specific column

Dear group, I have following input text file: Brit 2016 11 18 12 00 10 1.485,00 EUR Brit 2016 11 18 12 00 10 142,64 EUR Brit 2016 11 18 12 00 10 19,80 EUR Brit 2016 11 18 12 00 10 545,00 EUR Brit 2016 11 18 12 00 10 6.450,00 EUR... (3 Replies)
Discussion started by: gfhsd
3 Replies
TORRUS_NODEID(8)						      torrus							  TORRUS_NODEID(8)

NAME
nodeid - Torrus utility SYNOPSIS
torrus nodeid --tree=TREENAME --cmd=CMD options... DESCRIPTION
This command provides a way to integrate Torrus with external OSS systems. It operates with nodeid, a unique identifier for Torrus datasource subtrees and leaves. The command prints the data on the standard output in JSON data format. OPTIONS
--tree=TREE [Mandatory] Defines the datasouerce tree. --cmd=CMD [Mandatory] Defines the action command. The following commands are supported: o info Prints information about the nodeid. Requires --nodeid. o search Performs a prefix or substring search on node IDs and prints the results. Requires --prefix or --substring. o render Renders a specified datasource node and prints the resulting MIME type and the file name. Requires --nodeid and --view. Optional --out defines a file name to copy the output to. --nodeid=NODEID Specifies the Node ID string for the commands info and render. --details Toggles verbose output for the commands info and search. --prefix=STR Specifies the prefix search string for the command search. --substring=STR Specifies the search substring for the command search. --view=VIEW Specifies the view name for the command render. The following views are defined by standard Torrus XML files and render a PNG graph: "short", "last24h-small", "last24h", "lastweek", "lastmonth", "lastyear". The following views are printing the datasource value in a text format: "rrd-print-daily", "rrd-print-last". --out=FILE If defined, instructs the utility to copy the rendered data into a specified file. Otherwise the file is created in the standard renderer's cache directory. --help Displays a help message. SEE ALSO
torrus(8) NOTES
See more documentation at Torrus home page: http://torrus.org AUTHOR
Stanislav Sinyagin <ssinyagin@yahoo.com> torrus 2.03 2013-07-26 TORRUS_NODEID(8)
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy