[Solved] Shell : Can someone show me how to used these ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] Shell : Can someone show me how to used these ?
# 1  
Old 02-27-2014
[Solved] Shell : Can someone show me how to used these ?

Code:
${var%pattern}
    removes the shortest suffix of $var patching pattern 
${var%%pattern}
    removes the longest suffix of $var patching pattern 
${var#pattern}
    removes the shortest prefix of $var patching pattern 
${var##pattern}
    removes the longest prefix of $var patching pattern

# 2  
Old 02-27-2014
Check this, illustrated with examples

Bash String

HTH

--ahamed
These 2 Users Gave Thanks to ahamed101 For This Post:
# 3  
Old 02-27-2014
Sweet !! That was exactly what I was looking for ... simple easy to understand.

Thanks again !!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Tip: show the last 3 directories in the shell prompt

tcsh: have the following in .cshrc (or .tcshrc) set prompt=": " zsh: have the following in .zshrc PS1="%# " bash: have the following in .bashrc PS1='\$ 'Lacking direct support this is a good approximation. (0 Replies)
Discussion started by: MadeInGermany
0 Replies

2. UNIX for Dummies Questions & Answers

[Solved] Korn Shell execution

There are two Korn Shell scripts : script_1.ksh ( located in /home/dir1 ) script_2.ksh ( located in /home/dir2 ) Content of script_2.ksh is #!/usr/bin/ksh echo "Hello world.." The script_2.ksh is called from within script_1.ksh using the following command : ./home/dir2/script_2.ksh but... (7 Replies)
Discussion started by: kumarjt
7 Replies

3. Shell Programming and Scripting

[Solved] Shell scripting

I am new to write scripts. I want help to write a shell script to create 10 users and passwords to users. Can any please help me. (9 Replies)
Discussion started by: DONFOX
9 Replies

4. Shell Programming and Scripting

[Solved] Shell script help

Hi fellas, I have a file that contains text something like this SNAPSHOT snap-021ede4a vol-bc3f89c0 completed 2012-11-19T06:05:26+0000 100% 170495546006 850 Created by CreateImage(i-6adc0515) for ami-977dfafe from vol-bc3f89c0 TAG snapshot snap-021ede4a project PAC TAG snapshot... (5 Replies)
Discussion started by: Kashyap
5 Replies

5. Shell Programming and Scripting

[Solved] Show lines above and below!

hello team - anyone can help shwoing how to grep a file showing the lines above and below? Thx Bragabio (7 Replies)
Discussion started by: bragabio
7 Replies

6. Shell Programming and Scripting

[Solved] need help in shell scripting

Hi Friends, Please help me with the following problem: I have a text file with the following lines: Dated: 8/11/2011 <br> Time : 0000 <br> ============== <br> --------------------------------------<br>Data Upload Time =4:51:52... (2 Replies)
Discussion started by: anuajay1988
2 Replies

7. Shell Programming and Scripting

How we can create the master file through shell to show the tree structure of the directory?

Can we create the master file that show the whole tree structure of the directory till a particular folder? Database that contains four sub repository Sybase,sql,oracle,mysql and sql and oracle contains two subrepostories Siebel and plsql and each repositories contains three folders... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies

8. UNIX for Dummies Questions & Answers

Shell Scripts - Show all directories with full information ( and no files)

Hello all, i'm stumped.... I need to list all directories with all there info and exclude the files, then vice versa. I am not sure if I need to string several ls commands together or how to even do that. I believe I need to do some variation of ls -l but need to figure out how to take out the... (5 Replies)
Discussion started by: citizencro
5 Replies

9. Shell Programming and Scripting

[Solved] help me in this looping in shell scripting

Hi, #!/bin/ksh result='/TIA/app/UniQP/queue/document/CSB' i=0; while ; do i=`expr $i + 1` if ($i -lt 5);then echo "THerrFile_$i.err"; else break; fi done ... (0 Replies)
Discussion started by: sudhir_83k
0 Replies

10. SuSE

Write shell script using menu-driven approach to show various system

QUESTION: Write shell script using menu-driven approach to show various system configuration like 1) Currently logged user and his logname 2) Your current shell 3) Your home directory 4) Your current path setting 5) Your current working directory 6) Show Currently logged number of... (1 Reply)
Discussion started by: bboyjervis
1 Replies
Login or Register to Ask a Question