Sponsored Content
Top Forums Shell Programming and Scripting how to remove this substring? Post 302503745 by seafan on Friday 11th of March 2011 01:09:47 PM
Old 03-11-2011
echo "${LOCATION%/*}"
returns empty/null

---------- Post updated at 12:09 PM ---------- Previous update was at 11:44 AM ----------

this returns empty/null as well:

$ echo "$LOCATION" | sed 's!.*=\(.*\)/.*!\1!'

which makes me wonder if there is some shell env variable that needs to be set for this and the previous

echo "${LOCATION%/*}"

?
 

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

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..... (5 Replies)
Discussion started by: samtekdallas
5 Replies

5. Shell Programming and Scripting

substring

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

6. 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

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
wcsstr(3)						     Library Functions Manual							 wcsstr(3)

NAME
wcsstr - Finds a wide-character substring LIBRARY
Standard C Library (libc) SYNOPSIS
#include <wchar.h> wchar_t *wcsstr( const wchar_t *s1, const wchar_t *s2); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: wcsstr(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the wide-character string being searched. Specifies the wide-character substring to be located. DESCRIPTION
The wcsstr() function locates the first occurrence in the wide-character string pointed to by the s1 parameter of the sequence of wide characters in the wide-character string pointed to by the s2 parameter, excluding the terminating null wide character. RETURN VALUES
Upon successful completion, the wcsstr() function returns a pointer to the located wide-character substring or a null pointer when the sub- string is not found. If the s2 parameter points to a wide-character substring having 0 (zero) length, the wcsstr() function returns the entire wide-character string pointed to by parameter s1. [Tru64 UNIX] On error, the function returns a null pointer. RELATED INFORMATION
Functions: strstr(3), wcswcs(3) Standards: standards(5) delim off wcsstr(3)
All times are GMT -4. The time now is 01:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy