Sponsored Content
Top Forums Shell Programming and Scripting Extract a string from another string in UNIX Post 302758929 by elixir_sinari on Monday 21st of January 2013 04:46:54 AM
Old 01-21-2013
bash/ksh93:
Code:
$ string="Please have a nice day and sleep well Replace_12123_31233_32134_12342 Good day"

$ string=${string//Replace_12123_31233_32134_12342/REPLACED}

$ echo $string
Please have a nice day and sleep well REPLACED Good day

 

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
curl_getdate(3) 						  libcurl Manual						   curl_getdate(3)

NAME
curl_getdate - Convert an date in a ASCII string to number of seconds since January 1, 1970 SYNOPSIS
#include <curl/curl.h> time_t curl_getdate(char *datestring, time_t *now"); DESCRIPTION
This function returns the number of seconds since January 1st 1970, for the date and time that the datestring parameter specifies. The now parameter is there and should hold the current time to allow the datestring to specify relative dates/times. Read further in the date string parser section below. PARSING DATES AND TIMES
A "date" is a string, possibly empty, containing many items separated by whitespace. The whitespace may be omitted when no ambiguity arises. The empty string means the beginning of today (i.e., midnight). Order of the items is immaterial. A date string may contain many flavors of items: calendar date items This can be specified in a number of different ways. Including 1970-09-17, 70-9-17, 70-09-17, 9/17/72, 24 September 1972, 24 Sept 72, 24 Sep 72, Sep 24, 1972, 24-sep-72, 24sep72. The year can also be omitted, for example: 9/17 or "sep 17". time of the day items This string specifies the time on a given day. Syntax supported includes: 18:19:0, 18:19, 6:19pm, 18:19-0500 (for specifying the time zone as well). time zone items Specifies international time zone. There are a few acronyms supported, but in general you should instead use the specific realtive time compared to UTC. Supported formats include: -1200, MST, +0100. day of the week items Specifies a day of the week. If this is mentioned alone it means that day of the week in the future. Days of the week may be spelled out in full: `Sunday', `Monday', etc or they may be abbreviated to their first three letters, optionally followed by a period. The special abbreviations `Tues' for `Tuesday', `Wednes' for `Wednesday' and `Thur' or `Thurs' for `Thursday' are also allowed. A number may precede a day of the week item to move forward supplementary weeks. It is best used in expression like `third mon- day'. In this context, `last DAY' or `next DAY' is also acceptable; they move one week before or after the day that DAY by itself would represent. relative items A relative item adjusts a date (or the current date if none) forward or backward. Example syntax includes: "1 year", "1 year ago", "2 days", "4 weeks". The string `tomorrow' is worth one day in the future (equivalent to `day'), the string `yesterday' is worth one day in the past (equivalent to `day ago'). pure numbers If the decimal number is of the form YYYYMMDD and no other calendar date item appears before it in the date string, then YYYY is read as the year, MM as the month number and DD as the day of the month, for the specified calendar date. RETURN VALUE
This function returns zero when it fails to parse the date string. Otherwise it returns the number of seconds as described. AUTHORS
Originally written by Steven M. Bellovin <smb@research.att.com> while at the University of North Carolina at Chapel Hill. Later tweaked by a couple of people on Usenet. Completely overhauled by Rich $alz <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990. SEE ALSO
BUGS
Surely there are some, you tell me! libcurl 7.0 5 March 2001 curl_getdate(3)
All times are GMT -4. The time now is 02:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy