10-04-2008
extract a sub string from a main string
i need a shell program to extract a substring from a main string..
for eg:- main string is madhu..
sub string is mad
o/p:- be mad.
try to solve this one
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
i need a shell program,to extract a string from a main string.
main string is "madhu"
sub string is "mad"..means any word from the main string
please di this (1 Reply)
Discussion started by: madhu.it
1 Replies
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
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
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
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 (3 Replies)
Discussion started by: qwertyu
3 Replies
7. Shell Programming and Scripting
Hi ,
am getting output file, it sontains the below values.
./hawk_DOM1_FIRST_ENV
./hawk_DOM2_SECOND_ENV
./hawk_DOM3_THIRD_ENV
Now I need to grep the word "DOM1_FIRST_ENV","DOM2_SECOND_ENV"
like that.
I tired with cut -d "_". Its not working with any deleimiter.
Can you please help to... (3 Replies)
Discussion started by: ckchelladurai
3 Replies
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
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
LEARN ABOUT NETBSD
getprogname
GETPROGNAME(3) BSD Library Functions Manual GETPROGNAME(3)
NAME
getprogname, setprogname -- get/set the name of the current program
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdlib.h>
const char *
getprogname(void);
void
setprogname(const char *name);
DESCRIPTION
These utility functions get and set the current program's name as used by various error-reporting functions.
getprogname() returns the name of the current program. This function is typically useful when generating error messages or other diagnostic
output. If the program name has not been set, getprogname() will return NULL.
setprogname() sets the name of the current program to be the last pathname component of the name argument. It should be invoked at the start
of the program, using the argv[0] passed into the program's main() function. A pointer into the string pointed to by the name argument is
kept as the program name. Therefore, the string pointed to by name should not be modified during the rest of the program's operation.
A program's name can only be set once, and in NetBSD that is actually done by program start-up code that is run before main() is called.
Therefore, in NetBSD, calling setprogname() explicitly has no effect. However, portable programs that wish to use getprogname() should call
setprogname() from main(). On operating systems where getprogname() and setprogname() are implemented via a portability library, this call
is needed to make the name available.
SEE ALSO
err(3), setproctitle(3)
HISTORY
The getprogname and setprogname function calls appeared in NetBSD 1.6.
RESTRICTIONS
The string returned by getprogname() is supplied by the invoking process and should not be trusted by setuid or setgid programs.
BSD
May 21, 2011 BSD