Sponsored Content
Top Forums Shell Programming and Scripting Extract a string from another string in UNIX Post 302758923 by qwertyu on Monday 21st of January 2013 04:26:15 AM
Old 01-21-2013
Extract a string from another string in UNIX

I have a string

string="Please have a nice day and sleep well Replace_12123_31233_32134_12342 Good day"

How do i replace "Replace_12123_31233_32134_1234" in the above string.??

Please help.

Regards,
Qwerty
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to extract a portion of a string from the whole string

How to extract a portion of a string from a full string using unix. For example: Say source string is = "req92374923.log" I want only the numeric portion of the string say "92374923" how to do that in Unix. (2 Replies)
Discussion started by: ds_sastry
2 Replies

2. Shell Programming and Scripting

Search for string in a file and extract another string to a variable

Hi, guys. I have one question: I need to search for a string in a file, and then extract another string from the file and assign it to a variable. For example: the contents of the file (group) is below: ... ftp:x:23: mail:x:34 ... testing:x:2001 sales:x:2002 development:x:2003 ...... (6 Replies)
Discussion started by: daikeyang
6 Replies

3. Shell Programming and Scripting

extract digits from a string in unix

Hi all, i have such string stored in a variable var1 = 00000120 i want the o/p var1 = 120 is it possible to have such o/p in ksh/bash ... thanx in advance for the help sonu (3 Replies)
Discussion started by: sonu_pal
3 Replies

4. Shell Programming and Scripting

to extract string from main string and string comparison

continuing from my previous post, whose link is given below as a reference https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569 consider there is create table commands in a file for eg: CREATE TABLE `Blahblahblah` ( `id` int(11) NOT NULL... (2 Replies)
Discussion started by: vivek d r
2 Replies

5. Shell Programming and Scripting

Extract a string between 2 ref string from a file

Hi, May i ask if someone share some command for extracting a string between 2 ref string in a txt file My objective: i had a file with multiple lines and wants only to extract the string "watch?v=IbkAXOmEHpY" or "watch?v=<11 random character>", when i used "grep 'watch?=*' i got a results per... (4 Replies)
Discussion started by: jao_madn
4 Replies

6. Shell Programming and Scripting

Extract First and matching word from string in UNIX

Thank you (2 Replies)
Discussion started by: Pratik Majithia
2 Replies

7. Shell Programming and Scripting

Search String and extract few lines under the searched string

Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed Bold letters are the stations . The whole file has multiple stations . Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

8. Shell Programming and Scripting

To Search for a string and to extract the string from the text

Hi Team I have an huge xml where i need to search for a ceratin numbers. For example 2014-05-06 15:15:41,498 INFO WebContainer : 10 CommonServicesLogs - CleansingTriggerService.invokeCleansingService Entered PUBSUB NOTIFY MESSAGE () - <?xml version="1.0" encoding="UTF-8"... (5 Replies)
Discussion started by: Kannannair
5 Replies

9. Shell Programming and Scripting

How to extract every repeated string between two specific string?

Hello guys, I have problem with hpux shell script. I have one big text file that contains like SOH bla bla bla bla bla bla ETX SOH bla bla bla ETX SOH bla bla bla ETX What I need to do is save first SOH*BLA into file1.txt, save second SOH*BLA into file2.txt and so on.... (17 Replies)
Discussion started by: sembii
17 Replies

10. Shell Programming and Scripting

How can I extract digits at the end of a string in UNIX shell scripting?

How can I extract digits at the end of a string in UNIX shell scripting or perl? cat file.txt abc_d123_4567.txt A246_B789.txt B123cc099.txt a123_B234-012.txt a13.txt What can I do here? Many thanks. cat file.txt | sed "s/.txt$//" | ........ 4567 789 099 012 13 (11 Replies)
Discussion started by: mingch
11 Replies
langinfo.h(3HEAD)						      Headers							 langinfo.h(3HEAD)

NAME
langinfo.h, langinfo - language information constants SYNOPSIS
#include <langinfo.h> DESCRIPTION
The <langinfo.h> header contains the constants used to identify items of langinfo data (see nl_langinfo(3C)). The type of the constant, nl_item, is defined as described in <nl_types.h>. The following constants are defined. The entries under Category indicate in which setlocale(3C) category each item is defined. | | Constant | Category | Meaning ----------------+----------------+---------------------------------------- CODESET |LC_CTYPE |codeset name ----------------+----------------+---------------------------------------- D_T_FMT |LC_TIME |string for formatting date and time ----------------+----------------+---------------------------------------- D_FMT |LC_TIME |date format string ----------------+----------------+---------------------------------------- T_FMT |LC_TIME |time format string ----------------+----------------+---------------------------------------- T_FMT_AMPM |LC_TIME |a.m. or p.m. time format string ----------------+----------------+---------------------------------------- AM_STR |LC_TIME |ante-meridiem affix ----------------+----------------+---------------------------------------- PM_STR |LC_TIME |post-meridiem affix ----------------+----------------+---------------------------------------- DAY_1 |LC_TIME |name of the first day of the week (for | |example, Sunday) ----------------+----------------+---------------------------------------- DAY_2 |LC_TIME |name of the second day of the week (for | |example, Monday) ----------------+----------------+---------------------------------------- DAY_3 |LC_TIME |name of the third day of the week (for | |example, Tuesday) ----------------+----------------+---------------------------------------- DAY_4 |LC_TIME |name of the fourth day of the week (for | |example, Wednesday) ----------------+----------------+---------------------------------------- DAY_5 |LC_TIME |name of the fifth day of the week (for | |example, Thursday) ----------------+----------------+---------------------------------------- DAY_6 |LC_TIME |name of the sixth day of the week (for | |example, Friday) ----------------+----------------+---------------------------------------- DAY_7 |LC_TIME |name of the seventh day of the week | |(for example, Saturday) ----------------+----------------+---------------------------------------- ABDAY_1 |LC_TIME |abbreviated name of the first day of | |the week ----------------+----------------+---------------------------------------- ABDAY_2 |LC_TIME |abbreviated name of the second day of | |the week ----------------+----------------+---------------------------------------- ABDAY_3 |LC_TIME |abbreviated name of the third day of | |the week ----------------+----------------+---------------------------------------- ABDAY_4 |LC_TIME |abbreviated name of the fourth day of | |the week ----------------+----------------+---------------------------------------- ABDAY_5 |LC_TIME |abbreviated name of the fifth day of | |the week ----------------+----------------+---------------------------------------- ABDAY_6 |LC_TIME |abbreviated name of the seventh day of | |the week ----------------+----------------+---------------------------------------- ABDAY_7 |LC_TIME |abbreviated name of the seventh day of | |the week ----------------+----------------+---------------------------------------- MON_1 |LC_TIME |name of the first month of the year ----------------+----------------+---------------------------------------- MON_2 |LC_TIME |name of the second month ----------------+----------------+---------------------------------------- MON_3 |LC_TIME |name of the third month ----------------+----------------+---------------------------------------- MON_4 |LC_TIME |name of the fourth month ----------------+----------------+---------------------------------------- MON_5 |LC_TIME |name of the fifth month ----------------+----------------+---------------------------------------- MON_6 |LC_TIME |name of the sixth month ----------------+----------------+---------------------------------------- MON_7 |LC_TIME |name of the seventh month ----------------+----------------+---------------------------------------- MON_8 |LC_TIME |name of the eighth month ----------------+----------------+---------------------------------------- MON_9 |LC_TIME |name of the ninth month ----------------+----------------+---------------------------------------- MON_10 |LC_TIME |name of the tenth month ----------------+----------------+---------------------------------------- MON_11 |LC_TIME |name of the eleventh month ----------------+----------------+---------------------------------------- MON_12 |LC_TIME |name of the twelfth month ----------------+----------------+---------------------------------------- ABMON_1 |LC_TIME |abbreviated name of the first month ----------------+----------------+---------------------------------------- ABMON_2 |LC_TIME |abbreviated name of the second month ----------------+----------------+---------------------------------------- ABMON_3 |LC_TIME |abbreviated name of the third month ----------------+----------------+---------------------------------------- ABMON_4 |LC_TIME |abbreviated name of the fourth month ----------------+----------------+---------------------------------------- ABMON_5 |LC_TIME |abbreviated name of the fifth month ----------------+----------------+---------------------------------------- ABMON_6 |LC_TIME |abbreviated name of the sixth month ----------------+----------------+---------------------------------------- ABMON_7 |LC_TIME |abbreviated name of the seventh month ----------------+----------------+---------------------------------------- ABMON_8 |LC_TIME |abbreviated name of the eighth month ----------------+----------------+---------------------------------------- ABMON_9 |LC_TIME |abbreviated name of the ninth month ----------------+----------------+---------------------------------------- ABMON_10 |LC_TIME |abbreviated name of the tenth month ----------------+----------------+---------------------------------------- ABMON_11 |LC_TIME |abbreviated name of the eleventh month ----------------+----------------+---------------------------------------- ABMON_12 | LC_TIME |abbreviated name of the twelfth month ----------------+----------------+---------------------------------------- ERA |LC_TIME |era description segments ----------------+----------------+---------------------------------------- ERA_D_FMT |LC_TIME |era date format string ----------------+----------------+---------------------------------------- ERA_D_T_FMT |LC_TIME |era date and time format string ----------------+----------------+---------------------------------------- ERA_T_FMT |LC_TIME |era time format string ----------------+----------------+---------------------------------------- ALT_DIGITS |LC_TIME |alternative symbols for digits ----------------+----------------+---------------------------------------- RADIXCHAR |LC_NUMERIC |radix character ----------------+----------------+---------------------------------------- THOUSEP |LC_NUMERIC |separator for thousands ----------------+----------------+---------------------------------------- YESEXPR |LC_MESSAGES |affirmative response expression ----------------+----------------+---------------------------------------- NOEXPR |LC_MESSAGES |negative response expression ----------------+----------------+---------------------------------------- YESSTR |LC_MESSAGES |affirmative response for yes/no queries ----------------+----------------+---------------------------------------- NOSTR |LC_MESSAGES |negative response ro yes/no queries ----------------+----------------+---------------------------------------- CRNCYSTR |LC_MONETARY |local currency symbol, preceded by '-' | |if the symbol sould appear before the | |value, '+' if the symbol should appear | |after the value, or '.' if the symbol | |should replace the radix character If the locale's values for p_cs_precedes and n_cs_precedes do not match, the value of nl_langinfo(CRNCYSTR) is unspecified. The <langinfo.h> header declares the following as a function: char *nl_langinfo(nl_item); Inclusion of <langinfo.h> header may also make visible all symbols from <nl_types.h>. USAGE
Wherever possible, users are advised to use functions compatible with those in the ISO C standard to access items of langinfo data. In par- ticular, the strftime(3C) function should be used to access date and time information defined in category LC_TIME. The localeconv(3C) func- tion should be used to access information corresponding to RADIXCHAR, THOUSEP, and CRNCYSTR. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
mkmsgs(1), localeconv(3C), nl_langinfo(3C), nl_types.h(3HEAD), setlocale(3C), strftime(3C), attributes(5), standards(5) SunOS 5.11 30 Aug 2002 langinfo.h(3HEAD)
All times are GMT -4. The time now is 01:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy