Sponsored Content
Top Forums Shell Programming and Scripting how to display only last character of a string? Post 302158749 by radoulov on Wednesday 16th of January 2008 06:58:46 AM
Old 01-16-2008
Or:

Code:
cut -c ${#s} <<<"$s"


or with ksh93 and bash:

Code:
$ echo ${s: -1}
g


Last edited by radoulov; 01-16-2008 at 08:26 AM.. Reason: ksh93/bash solution corrected
 

10 More Discussions You Might Find Interesting

1. Programming

converting character string to hex string

HI Hi I have a character string which contains some special characters and I need it to display as a hex string. For example, the sample i/p string: ×¥ïA Å gïÛý and the o/p should be : D7A5EF4100C5010067EFDBFD Any pointers or sample code pls. (5 Replies)
Discussion started by: axes
5 Replies

2. Shell Programming and Scripting

Display only found string

Is there a way for grep to output only the found string and not the whole line? I have a ksh script which reads in a file and loops through every line looking up on a grep -f list. For it to only display only the string found i pass this to awk as a variable and loop through the list file using... (5 Replies)
Discussion started by: Cranie
5 Replies

3. Shell Programming and Scripting

Korn: How to loop through a string character by character

If I have a string defined as: MyString=abcde echo $MyString How can I loop through it character by character? I haven't been able to find a way to index the string so that I loop through it. shew01 (10 Replies)
Discussion started by: shew01
10 Replies

4. Shell Programming and Scripting

Display of string with TAB in it

Hi, I am having trouble using the result of the following awk command in a script, as displaying the contents of the placeholder automatically replaces the new created TAB by a space character again: From the prompt: cscyabl@comet:(develop)> echo "01 12" | awk '{gsub(" ","\t");print}' 01 ... (2 Replies)
Discussion started by: Indalecio
2 Replies

5. Shell Programming and Scripting

Trying to display a tab character in variable

Hi, I'm trying to figure out a way to encapsulate a tab character, or four or five space characters into a string variable to be used in my script. I'm using the bash shell. I tried $variablename=" <string text>" but it didnt give me the output i wanted (output was still... (7 Replies)
Discussion started by: rowlf
7 Replies

6. Programming

Netbeans ide can't display chinese character in linux

When i write the source code in netbeans environment,if the source code,there are chinese characters,chinese characters will be displayed as box,how to solve this problem?please (2 Replies)
Discussion started by: fang_xiaoan
2 Replies

7. UNIX for Dummies Questions & Answers

Display last 8 character of filename

I would like to display the last 8 characters of the filenames for filenames of different lengths. I can delete the last 8 characters with sed but dont know how to only show the last 8 characters. The filenames are something like; afxH340800340000 afxH30800340021 afxR3080034002122 I... (3 Replies)
Discussion started by: Beanz
3 Replies

8. Shell Programming and Scripting

Display the string issue

Hi, i ran following bdf command and found below out with space uses. prd@prd02/usr/apps/cti>bdf | grep /usr/apps /dev/vg01/lvol6 17379328 9873783 7036696 58% /usr/apps /dev/vg01/SYBASE 1228800 978631 234597 81% /usr/apps/sybase 2150400 1108516 976776 ... (3 Replies)
Discussion started by: koti_rama
3 Replies

9. Shell Programming and Scripting

sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi, Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank. Text file : "1"|"ExternalClassDEA519CF5"|"Art1" "2"|"ExternalClass563EA516C"|"Art3" "3"|"ExternalClass305ED16B8"|"Art9" ... ... ... (2 Replies)
Discussion started by: fspalero
2 Replies

10. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies
xcutsel(1X)															       xcutsel(1X)

NAME
xcutsel - interchange between cut buffer and selection SYNOPSIS
xcutsel [-toolkitoption...] [-selection selection] [-cutbuffer number] OPTIONS
xcutsel accepts all of the standard X Toolkit command line options as well as the following: This option specifies the name of the selec- tion to use. The default is PRIMARY. The only supported abbreviations for this option are "-select", "-sel" and "-s", as the standard toolkit option "-selectionTimeout" has a similar name. This option specifies the cut buffer to use. The default is cut buffer 0. DESCRIPTION
The xcutsel program is used to copy the current selection into a cut buffer and to make a selection that contains the current contents of the cut buffer. It acts as a bridge between applications that do not support selections and those that do. By default, xcutsel will use the selection named PRIMARY and the cut buffer CUT_BUFFER0. Either or both of these can be overridden by com- mand line arguments or by resources. An xcutsel window has the following buttons: When this button is pressed, xcutsel exits. Any selections held by xcutsel are automatically released. When this button is pressed, xcutsel copies the current selection into the cut buffer. When this button is pressed, xcutsel converts the current contents of the cut buffer into the selection. The button labels reflect the selection and cutbuffer selected by command line options or through the resource database. When the "copy 0 to PRIMARY" button is activated, the button will remain inverted as long as xcutsel remains the owner of the selection. This serves to remind you which client owns the current selection. Note that the value of the selection remains constant; if the cutbuffer is changed, you must again activate the copy button to retrieve the new value when desired. X DEFAULTS
This program accepts all of the standard X Toolkit resource names and classes as well as: This resource specifies the name of the selection to use. The default is PRIMARY. This resource specifies the number of the cut buffer to use. The default is 0. WIDGET NAMES
The following instance names may be used when user configuration of the labels in them is desired: This is the "copy SELECTION to BUFFER" button. This is the "copy BUFFER to SELECTION" button. This is the "quit" button. BUGS
There is no way to change the name of the selection or the number of the cut buffer while the program is running. SEE ALSO
X(1X), xclipboard(1X), xterm(1X), text widget documentation, individual client documentation for how to make a selection. AUTHOR
Ralph R. Swick, DEC/MIT Project Athena xcutsel(1X)
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy