Matching string


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Matching string
# 8  
Old 02-19-2008
nehaquick, come on now!

It is painfully clear to all of us that this is H-O-M-E-W-O-R-K ! You will find much more satisfaction in your work with the UNIX operating system by finding out yourself how this is done. We all, who could answer your question, have learned it once doing the same: not letting others do our work, but finding out ourselves how to solve this (and other) kind(s) of problem(s).

And as we experts are getting older and would like to see the message passed on instead of going wasted before the heathens, there is a rule imposed which enforces learning among the unixally impaired: the answering of homework questions is forbidden. Do it yourself!

bakunin

PS: by the way, this thread is violating our rules and therefore i wield my wand of thread-consummation against it ..... hnnnn....

-closed-

Last edited by bakunin; 02-20-2008 at 09:44 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Matching string

Hello all, i am trying to match a string and based on that proceed with my script or error out... i have a file called /tmp/sta.log that will be populated by oracle's spooling..it can have a output of either 2 of the below (OPEN or errors/ORACLE not avaiable) $ cat /tmp/sta.log OPEN $ $... (2 Replies)
Discussion started by: abdul.irfan2
2 Replies

2. Shell Programming and Scripting

String matching using awk

Hello, I am working with google ngram data set which is of size 100s of gb. Before using it with Java, I wanted to filter it out using shell script. Here is a sample line in the file: 2.55 1.57 1992 10 20 30 The first two fields (2.55 and 1.57) are... (3 Replies)
Discussion started by: shekhar2010us
3 Replies

3. Shell Programming and Scripting

Matching string from input to string of file

Hi, i want to know how to compare string of file with input string im trying following code: file_no=`paste -s -d "||||\n" a.txt | cut -c 1` #it will return collection number from file echo "enter number" read " curr_no" if ; then echo " current number already present" fi ... (4 Replies)
Discussion started by: a_smith
4 Replies

4. Shell Programming and Scripting

String matching

I have a string like ab or abc of whatever length. But i want to know whether another string ( for example, abcfghijkl, OR a<space> bcfghijkl ab<space> cfghijkl OR a<space>bcfghijkl OR ab<space> c<space> fghijkl ) starts with ab or abc... space might existing on the longer string... If so, i... (4 Replies)
Discussion started by: nram_krishna@ya
4 Replies

5. Shell Programming and Scripting

Matching 2 items in a string

Little lost here, I am trying to search a line for both values after the $ signs. My ultimate goal is to get percertage. <?php $string = "Something on sale for $4 and orginal price $10"; $strstr =. strstr($string, '$'); $strrchr =. strrchr($string, '$'); echo "$strstr<br>"; echo... (1 Reply)
Discussion started by: mrlayance
1 Replies

6. Shell Programming and Scripting

matching a string

I have a requirement of shell script where i need to read the File name i.e ls -t | head -1 and Match that Filename with some delimited values which are in a separate File. For Example i am reading the File name i.e (ls -t | head -1) after that i need to read one more sequential file which... (2 Replies)
Discussion started by: dsdev_123
2 Replies

7. Shell Programming and Scripting

string matching in perl

Hi, I have to search for a string in a variable. Say the variable is var1='ERROR: Make java] as enabled' here i want to match which are in red color. other like abc etc could change. Can you tell me the exact command something like the below in perl if ($var1=~ m/ERROR: Make... (3 Replies)
Discussion started by: ammu
3 Replies

8. Shell Programming and Scripting

String matching

for a certain directory, I want to grep a particular file called ABCD so what I do is ls /my/dir | grep -i "ABCD" | awk '{print $9}' however, there is also this file called ABCDEFG, the above command would reurn both file when I only want ABCD, please help! (3 Replies)
Discussion started by: mpang_
3 Replies

9. Shell Programming and Scripting

sed problem - replacement string should be same length as matching string.

Hi guys, I hope you can help me with my problem. I have a text file that contains lines like this: 78 ANGELO -809.05 79 ANGELO2 -5,000.06 I need to find all occurences of amounts that are negative and replace them with x's 78 ANGELO xxxxxxx 79... (4 Replies)
Discussion started by: amangeles
4 Replies

10. Shell Programming and Scripting

matching alphanumeric string

how to match an alphanumeric string like the following. i have to do like the following. if the input line is the data is {clock_91b} i have to replace that with the string was ("clock_91b") i tried like $line =~ s/the data is\s+\{(+)\}/the string was \(\"$1\"\)/ which... (4 Replies)
Discussion started by: sskb
4 Replies
Login or Register to Ask a Question
confstr(3)						     Library Functions Manual							confstr(3)

NAME
confstr - Determines the current value of a specified system variable defined by a string value LIBRARY
Standard C Library (libc) SYNOPSIS
#include <unistd.h> size_t confstr( int name, char *buf, size_t len); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: confstr(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the system variable setting to be returned. Valid values for the name parameter are defined in the unistd.h header file: Copies a value for the PATH environment variable that finds all standard utilities into the buffer. [Tru64 UNIX] Copies the official name of the installed operating system product into the buffer. [Tru64 UNIX] Copies the official system banner into the buffer. The banner typically consists of the vendor name followed by the product name. [Tru64 UNIX] Copies the product version information into the buffer. [Tru64 UNIX] Copies the official abbreviated company name of the operating system manufacturer into the buffer. If the abbreviated name was not specified, copies the full company name (same as _CS_VENDOR_NAME). [Tru64 UNIX] Copies the official company name of the operating system manufacturer into the buffer. Specifies values to be passed to utilities used in building an application. The name of the parameter establishes type-size constraints for the environment in which an application is being built: The int, long, pointer, and off_t types are treated as 32-bit types. The int, long, and pointer types are treated as 32-bit types, and the off_t type is treated as a type with at least 64 bits. The int type is treated as a 32-bit type, and the long, pointer, and off_t types are treated as 64-bit types. The int type is treated as a type with at least 32 bits, and the long, pointer, and off_t types are treated as types with at least 64 bits. The parameter suffix (id) identifies the component affected by the type-size constraint: The value of the parameter is the set of initial options (compilation options) to be given to cc or c89. The value of the parameter is the set of final options (loader options) to be given to cc or c89. The value of the parameter is the set of libraries to be given to cc or c89. The value of the parameter is the set of checking options to be given to lint. In all cases, if sysconf (_SC_XBS5_ILP32_OFFBIG) returns -1, the meaning of the passed values is unspecified. Points to the buffer into which the confstr function copies the name value. Specifies the size of the buffer storing the name value. DESCRIPTION
The confstr() function allows an application to determine the current setting of certain system parameters, limits, or options that are defined by a string value. The function is mainly used by applications to find the system default value for the PATH environment variable. If the following conditions are true, then the confstr() function copies that value into a len-byte buffer pointed to by the buf parameter: The len parameter is not 0 (zero) The name parameter has a system-defined value The buf parameter is not a null pointer If the string to be returned is longer than len bytes, including the terminating null, then the confstr() function truncates the string to len-1 bytes and adds a terminating null to the result. The application can detect that the string was truncated by comparing the value returned by confstr() with the value of len. If the value of the len parameter is set to 0 (zero) or the buf value is NULL, the confstr() function returns the size of the buffer needed to hold the entire system-defined value, but does not copy the string value. EXAMPLES
To find out how big a buffer is needed to store the _CS_PATH string value, enter: confstr(_CS_PATH, NULL, (size_t) 0) The confstr() function returns the size of the buffer necessary. RETURN VALUES
If the value specified by the name parameter is system-defined, the confstr() function returns the size of the buffer needed to hold the entire value. If this return value is greater than the specified len value, the string returned as the buf value is truncated. If the specified name value is invalid, a value of 0 (zero) is returned, and the errno global variable is set to indicate the error. If the specified name value does not have a system-defined value, the confstr() function returns a value of 0 (zero) and leaves errno unchanged. ERRORS
The confstr() function sets errno as follows: The value of the name parameter is invalid. FILES
Contains system-defined limits. Contains system-defined environment variables. RELATED INFORMATION
Functions: pathconf(2), sysconf(3) Standards: standards(5) delim off confstr(3)