Sponsored Content
Top Forums Shell Programming and Scripting How to do String manipulations using Substring function in Shell Post 302345038 by malcomex999 on Tuesday 18th of August 2009 09:26:13 AM
Old 08-18-2009
if u made a little search, you could have get what u wanted by urself....

Code:
 
str="/opt/project/data/int/holdFiles/csv195687.csv"
echo ${str##*/}
csv195687.csv

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Substring function in UNIX shell script

Hi All, Following is the output of a find commnd to locate log directories for various projects of UNIX AIX box: /home/hbinz6pf/projectlibs/dpr_pfsdw_dev/&PH& /opt/tools/ds/Template/&PH& /data/ds/ms/hmsdw/projectlibs/dpr_ms_dev/&PH& /data/ds/riskmi/projectlibs/dpr_riskmi_dev/&PH&... (1 Reply)
Discussion started by: csrazdan
1 Replies

2. UNIX for Dummies Questions & Answers

Substring function in UNIX shell script

Hi All, Following is the output of a find commnd to locate log directories for various projects of UNIX AIX box: /home/hbinz6pf/projectlibs/dpr_pfsdw_dev/&PH& /opt/tools/ds/Template/&PH& /data/ds/ms/hmsdw/projectlibs/dpr_ms_dev/&PH& /data/ds/riskmi/projectlibs/dpr_riskmi_dev/&PH&... (5 Replies)
Discussion started by: csrazdan
5 Replies

3. Shell Programming and Scripting

Substring Function

Just so you know guys, I am a SAP Person and I am very new to UNIX. I need a help on a one line code. In one of our script we are referring to a variable ($PN) which has the value /interfaces/DA1/DEV291/outbound/INVOIC which is being used in ftp command. I am just looking for a command to... (1 Reply)
Discussion started by: sasikumar_l
1 Replies

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

5. Shell Programming and Scripting

help for shell script of finding shortest substring from given string by user

please give me proper solution for finding a shortest substring from given string if string itself and first char and last char of that substr are also given by user if S="dpoaoqooroo" and FC="o" and LC="o",then shortest substr is "oo" and rest of the string is "dpoaoqroo" i have code but it is... (1 Reply)
Discussion started by: pankajd
1 Replies

6. Linux

Selecting substring (like SQL Server function)

Hey, geniuses of the world (no--facetious is NOT the word of the day;))! I was wondering if there's a way to extract a specific portion from a string of characters in UNIX/LINUX. Give me the generic capabilities (assuming they exist) and I'll figure out the small details. But if you know... (8 Replies)
Discussion started by: ProGrammar
8 Replies

7. Shell Programming and Scripting

Substring a returned function value

Hello, I have something that should be very simple yet I am losing my head in figuring out how to get it to work: I am calling a function passing a parameter, this will return a particular string, next I want to substring the returned value and break it apart. All of this I want to do on a... (2 Replies)
Discussion started by: gio001
2 Replies

8. UNIX for Dummies Questions & Answers

Substring Function

I have a file in which there are other file path and names /home/data/abc.txt /home/data/sdf.txt /home/data/sdg.txt how can I get the file names i.e. abc.txt sdf.txt sdg.txt I searched the forum for sed command but it was confusing to me (10 Replies)
Discussion started by: eskay
10 Replies

9. Shell Programming and Scripting

Pass a variable string in To_Date Oracle function in shell script

Hello, I am trying to execute an SQL query from shell script. A part of script is something like this: fromDate=`echo $(date +"%F%T") | sed "s/-//g" | sed "s/://g"` $ORACLE_HOME/sqlplus -s /nolog <<EOD1 connect $COSDBUID/$COSDBPWD@$COSDBSID spool... (4 Replies)
Discussion started by: sanketpatel.86
4 Replies

10. Shell Programming and Scripting

Extracting substring within string between 2 token within the string

Hello. First best wishes for everybody. here is the input file ("$INPUT1") contents : BASH_FUNC_message_begin_script%%=() { local -a L_ARRAY; BASH_FUNC_message_debug%%=() { local -a L_ARRAY; BASH_FUNC_message_end_script%%=() { local -a L_ARRAY; BASH_FUNC_message_error%%=() { local... (3 Replies)
Discussion started by: jcdole
3 Replies
MB_CONVERT_CASE(3)							 1							MB_CONVERT_CASE(3)

mb_convert_case - Perform case folding on a string

SYNOPSIS
string mb_convert_case (string $str, int $mode, [string $encoding = mb_internal_encoding()]) DESCRIPTION
Performs case folding on a string, converted in the way specified by $mode. PARAMETERS
o $str - The string being converted. o $mode - The mode of the conversion. It can be one of MB_CASE_UPPER, MB_CASE_LOWER, or MB_CASE_TITLE. o $encoding -The $encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used. RETURN VALUES
A case folded version of $string converted in the way specified by $mode. UNICODE
By contrast to the standard case folding functions such as strtolower(3) and strtoupper(3), case folding is performed on the basis of the Unicode character properties. Thus the behaviour of this function is not affected by locale settings and it can convert any characters that have 'alphabetic' property, such as A-umlaut (A). For more information about the Unicode properties, please see http://www.unicode.org/unicode/reports/tr21/. EXAMPLES
Example #1 mb_convert_case(3) example <?php $str = "mary had a Little lamb and she loved it so"; $str = mb_convert_case($str, MB_CASE_UPPER, "UTF-8"); echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO $str = mb_convert_case($str, MB_CASE_TITLE, "UTF-8"); echo $str; // Prints Mary Had A Little Lamb And She Loved It So ?> Example #2 mb_convert_case(3) example with non-Latin UTF-8 text <?php $str = "Txiotn a nE Baos unuvn yn, dpaokeCei unp vw0po kuvs"; $str = mb_convert_case($_tr, MB_CASE_UP_ER, "UTF_8"); _ _ echo $str; // Prints TXI>TH A/TTHH BAO> YHMNH | H, /PA>KE/EI YTTP NOOPO KYN> $str = mb_convert_case($str, MB_CASE_TITLE, "U_F-8"); echo $str; // Prints Txiotn A nE Baoo Ynuvn | n, /paokeCei Ynp Nw0po Kuvo ?> SEE ALSO
mb_strtolower(3), mb_strtoupper(3), strtolower(3), strtoupper(3), ucfirst(3), ucwords(3). PHP Documentation Group MB_CONVERT_CASE(3)
All times are GMT -4. The time now is 08:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy