Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to cut a string in two parts and show the other part Post 302425096 by sudhakarn on Thursday 27th of May 2010 07:23:46 AM
Old 05-27-2010
resultingstring=$(echo $string | cut -d":" -f2)


say string="sumthing:nothing"

resultingstring will have "nothing".
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A problem for sed? Remove parts of a string

Hi, My knowledge about sed is limited but I have a problem that I think can be solved with sed. I have a variable in a shell script that stores a lot of path/filenames and the delimitter between them is a space (they all exist on the same line). One part of the filename is the file creation... (4 Replies)
Discussion started by: pcrs
4 Replies

2. Shell Programming and Scripting

Truncate Specific Parts of a String

How do you truncate specific parts of a string. Example: 1 This is the string Goal: This is the string As you can see I'm trying to simply remove the first two characters of the string the number one and the space between the one and the word "this." Your help is appreciated. ... (8 Replies)
Discussion started by: royarellano
8 Replies

3. UNIX for Dummies Questions & Answers

cut and print part of a string

I have a file that contains: yahoo.com.23456 web.log.common.us.gov.8675 192.168.1.55.34443 john-doe.about.com.22233 64.222.3.4.120 sunny.ca.4442 how can i remove the strings after the last dot (.) and reprint the file? Thanks. (3 Replies)
Discussion started by: apalex
3 Replies

4. UNIX for Dummies Questions & Answers

increment numbers in several parts of a string

I know how to do produce this: string01 string02 string03 several different ways. But how do I do produce this (without getting lost in recursion): string01morestring100yetmore10 string02morestring101yetmore20 string03morestring102yetmore30 ...... (2 Replies)
Discussion started by: uiop44
2 Replies

5. Shell Programming and Scripting

Spliting bash string into parts

Hello, let's say I have this string: string1="A\nB\nC D E\nFG\nH"; How can I split it so as to take every string separated with '\n' separately? For example, as for $string1, it would be split into string1_part1="A" string1_part2="B" string1_part3="C D E" string1_part4="FG"... (5 Replies)
Discussion started by: hakermania
5 Replies

6. Shell Programming and Scripting

perl, splitting out specific parts of the string

Hi there, I have an output from a command like this # ypcat -k netgroup.byuser| grep steven steven.* users_main,users_sysadmin,users_global,users_backup_team and wanted to pull the 'users' netgroups returned into a perl array, that will look like this users_main... (2 Replies)
Discussion started by: rethink
2 Replies

7. Shell Programming and Scripting

Cut the path into two parts

Hi, file=/usr/lib I need to cut and put it into two variable like string1=/usr string2=lib I made it for string2 string2=${file#/*/} How to get String1 in the same way which I have get string2. Use even more code tags ;) (4 Replies)
Discussion started by: munna_dude
4 Replies

8. UNIX for Dummies Questions & Answers

How to cut part of a string in reverse?

Hi, how to cut part of a string sing delimiter in reverse input file 1,2,st-pa-tr-01,2,3,4, 2,3,ff-ht-05,6,7,8 how can i obtain strings till st-pa-tr ff-ht i.e cutting the last part og string -01 and -05 Thanks & Regards Nivi edit by bakunin: changed thread title (typo) (3 Replies)
Discussion started by: nivI
3 Replies

9. Shell Programming and Scripting

Parsing a log file to cut off some parts

Dear all, I would like to use SQL's log file to extract information from it. This file can include four different types of instruction with the number of lines involved for each of them: -> (1) "INSERT" instruction with the number of lines inserted -> (2) "UPDATE" instruction with the... (4 Replies)
Discussion started by: dae
4 Replies

10. Shell Programming and Scripting

How to get first four parts of the string?

I have the string: XXXX.YYYY_ZZZ.20180724.01.txt I need to get rid of .txt and get full four parts XXXX.YYYY_ZZZ.20180724.01 I did: CTL=`echo XXXX.YYYY_ZZZ.20180724.01.txt | rev | cut -d"." -f4 | rev` But got only YYYY_ZZZ What should I do to get all four parts of that... (4 Replies)
Discussion started by: digioleg54
4 Replies
LOCALE_GET_DISPLAY_LANGUAGE(3)						 1					    LOCALE_GET_DISPLAY_LANGUAGE(3)

Locale::getDisplayLanguage - Returns an appropriately localized display name for language of the inputlocale

	Object oriented style

SYNOPSIS
publicstatic string Locale::getDisplayLanguage (string $locale, [string $in_locale]) DESCRIPTION
Procedural style string locale_get_display_language (string $locale, [string $in_locale]) Returns an appropriately localized display name for language of the input locale. If is NULL then the default locale is used. PARAMETERS
o $locale - The locale to return a display language for o $in_locale - Optional format locale to use to display the language name RETURN VALUES
display name of the language for the $locale in the format appropriate for $in_locale. EXAMPLES
Example #1 locale_get_display_language(3) example <?php echo locale_get_display_language('sl-Latn-IT-nedis', 'en'); echo "; "; echo locale_get_display_language('sl-Latn-IT-nedis', 'fr'); echo "; "; echo locale_get_display_language('sl-Latn-IT-nedis', 'de'); ?> Example #2 OO example <?php echo Locale::getDisplayLanguage('sl-Latn-IT-nedis', 'en'); echo "; "; echo Locale::getDisplayLanguage('sl-Latn-IT-nedis', 'fr'); echo "; "; echo Locale::getDisplayLanguage('sl-Latn-IT-nedis', 'de'); ?> The above example will output: Slovenian; slovxc3xa8ne; Slowenisch SEE ALSO
locale_get_display_name(3), locale_get_display_script(3), locale_get_display_region(3), locale_get_display_variant(3). PHP Documentation Group LOCALE_GET_DISPLAY_LANGUAGE(3)
All times are GMT -4. The time now is 08:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy