Sponsored Content
Top Forums Shell Programming and Scripting hash, percent, carret, exclamation, etc special characters use Post 302601562 by itkamaraj on Friday 24th of February 2012 02:17:15 AM
Old 02-24-2012
Answer for your questions

${string##substring} Deletes longest match of $substring from front of $string

${string%%substring} Deletes longest match of $substring from back of $string.

Code:
 
$ a=one.txt
$ echo $a
one.txt
$ echo ${a##*.}
txt
$ echo ${a%%.*}
one


For more :
Manipulating Strings
This User Gave Thanks to itkamaraj For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

special characters

I have one file which is named ^? ( the DEL character ) I'd like to know how to rename or copy the file by using its i-node number TYIA (2 Replies)
Discussion started by: nawnaw
2 Replies

2. UNIX for Dummies Questions & Answers

how to see special characters in a file using vi

Hi, I have a file which has special characters. I can't see them when I "vi" the file. But I am sure there are some special un seen characters. How can I see them? Please help. Thx (6 Replies)
Discussion started by: jingi1234
6 Replies

3. UNIX for Dummies Questions & Answers

Array with special Characters

Hi, I would write a shell script to execute a series of command. However, if the cmd contains "-" in the array. It fails to do so. I'd tried use ', " or \ but get the same result. Output: (1 Reply)
Discussion started by: donaldfung
1 Replies

4. Shell Programming and Scripting

Special characters

When I open a file in vi, I see the following characters: \302\240 Can someone explain what these characters mean. Is it ASCII format? I need to trim those characters from a file. I am doing the following: tr -d '\302\240' ---------- Post updated at 08:35 PM ---------- Previous... (1 Reply)
Discussion started by: sid1982
1 Replies

5. UNIX for Dummies Questions & Answers

How to see special characters?

Hi all, I was wondering how can i see the special characters like \t, \n or anything else in a file by using Nano or any other linux command like less, more etc (6 Replies)
Discussion started by: gvj
6 Replies

6. Shell Programming and Scripting

special characters

Hey guys, I'm trying to replace "]Facebook" from the text but sed 's/]Facebook/Johan/g' is not working could you please help me with that? (6 Replies)
Discussion started by: Johanni
6 Replies

7. Shell Programming and Scripting

Replace special characters with Escape characters?

i need to replace the any special characters with escape characters like below. test!=123-> test\!\=123 !@#$%^&*()-= to be replaced by \!\@\#\$\%\^\&\*\(\)\-\= (8 Replies)
Discussion started by: laknar
8 Replies

8. UNIX for Advanced & Expert Users

special characters in IF TEST

I'm using Korn shell. I'm doing an IF TEST for lots of characters and don't know how to also check for single quote and parentheses and slash. I'm reading a file and some records have garbage characters in them. The following works, but how do I add single quote, parentheses and slash to the IF... (3 Replies)
Discussion started by: sboxtops
3 Replies

9. Shell Programming and Scripting

How to replace special characters?

Hi Unix Guru, I have an requirement for replace some specail characters in a file, my file came from mainframe. please see below example: when open it with vi 17896660|89059215|04/24/1998 00:00:00.000000| abc 123-453-1312^M<85>^M<85>|124557 if I run cat -v I got following:... (25 Replies)
Discussion started by: ken002
25 Replies

10. Shell Programming and Scripting

Delete special characters

My sed is not working on deleting the entire special characters and leaving what is necessary.grep connections_per a|sed -e 's/\<\!\-\-//g' INPUT: <!-- <connections_per_instance>1</connections_per_instance> --> <method>HALF</method> <!--... (10 Replies)
Discussion started by: kenshinhimura
10 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 09:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy