11-08-2013
That var will hold the count of substitutions that gsub has made on the string it worked upon. The string itself will be modified and thus holds the result.
This User Gave Thanks to RudiC For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear All,
I want to add Numeric data of my file called temp_f41. But I am not getting how to add them,
My File data are in following format of:
10
39
53
05
37
54
Plz send me code for this
Thanks
Nishant :mad: (3 Replies)
Discussion started by: krishna_sicsr
3 Replies
2. Shell Programming and Scripting
Hi All,
Is there any code in Perl which can differentiate between numeric and non-numeric input? (11 Replies)
Discussion started by: Raynon
11 Replies
3. Shell Programming and Scripting
During a file-system cleanup I noticed a strange behavior of awk (HP-UX 11iv3 / IA64). When summing up the size of files in one directory it gives different numbers when using print as opposed to printf:
find . -type f -name '*.dmp.Z' -mtime +35 -exec ls -l {} \+ | \
awk 'BEGIN{ OFMT="%f" } {... (1 Reply)
Discussion started by: pludi
1 Replies
4. Shell Programming and Scripting
I have a txt file as follows
Code:
Oct 1 file1 4144
Oct 1 file23 5170
Oct 2 file5 3434
Oct 21 file56 2343
I need to add a new column by marking the right log file from current directory. For example populate like this. Please not in the second columt for "1" it has... (2 Replies)
Discussion started by: gubbu
2 Replies
5. UNIX for Dummies Questions & Answers
i have a file called 'test.txt' which contains the below data.
abc123
123445
123abc
23224q
From the above data, i want to display the line which contains only numeric . So i have tried the below commands with sed
sed -n '/^$/p' test.txt
sed '/^$/!d' test.txt
But it... (4 Replies)
Discussion started by: pandeesh
4 Replies
6. Shell Programming and Scripting
Hi,
I have a text file with the following content:
monday,20
tuesday,10
wednesday,29
monday,10
friday,12
wednesday,14
monday,15
thursday,34
i want the following output:
monday,45
tuesday,10
wednesday,43
friday,12 (3 Replies)
Discussion started by: prashu_g
3 Replies
7. Shell Programming and Scripting
Hello Gurus,
I have a requirement where I have to filter a value from some field which has 99% or greater than '99%'..
For ex:
The Date (file -- sample.csv) will be like below
Field1,Field2,Field3,Field4
860440512,844284992,16155520,99%
860440512,844284992,16155520,94%... (4 Replies)
Discussion started by: raghu.iv85
4 Replies
8. Shell Programming and Scripting
In file1 field $18 is removed.... column header is "Otherinfo", then each line in file1 is used to search file2 for a match. When a match is found the last four strings in file2 are copied to file1.
Maybe:
cut -f1-17 file1 and then match each line to file2
file1
Chr Start End ... (6 Replies)
Discussion started by: cmccabe
6 Replies
9. UNIX for Beginners Questions & Answers
I cannot seem to get what should be a simple awk one-liner to work correctly and cannot figure out why. I would like to use patterns from a specific field in one file as regex to search for matching strings in the entire line ($0) of another file.
I would like to output the lines of File2 which... (1 Reply)
Discussion started by: jvoot
1 Replies
10. Shell Programming and Scripting
Hello,
I have some video files containing numbers and characters . To tell the problem shortly, due to a limitation, I am unable create a playlist regularly changing on a daily basis with the command shuffle....So I decided to rename filenames, just a replacement of first five numbers randomly.... (10 Replies)
Discussion started by: baris35
10 Replies
LEARN ABOUT HPUX
xtfindfile
XtFindFile() XtFindFile()
Name
XtFindFile - search for a file using substitutions in a path.
Synopsis
String XtFindFile(path, substitutions, num_substitutions, predicate)
String path;
Substitution substitutions;
Cardinal num_substitutions;
XtFilePredicate predicate;
Inputs
path Specifies a path of file names including substitution characters.
substitutions
Specifies a list of substitutions to make into the path.
num_substitutions
Specifies the number of substitutions passed in.
predicate Specifies a procedure called to judge each potential file name, or NULL.
Returns
A filename, or NULL if no file was found.
Availability
Release 4 and later.
Description
XtFindFile() performs the substitutions specified by substitutions on each colon-separated element of path in turn, and passes the result-
ing string to predicate. If predicate returns True, XtFindFile() returns the string. If predicate never returns True, XtFindFile()
returns NULL.
Each element in substitutions is a structure that contains a character and a string. If any element in path contains a percent sign fol-
lowed by a character that appears in substitutions, then that two-character sequence will be replaced by the corresponding string in sub-
stitutions. The "Background" section below provides more details about the substitution process.
If predicate is NULL, then an internal predicate is used that returns True if the string is the name of a readable file (and is not a
directory), and returns False otherwise. See XtFilePredicate(2) for more details on how to write a file predicate procedure.
The caller must free the returned string with XtFree() when it is no longer needed.
Usage
XtFindFile() is intended as a way to find a file that depends on variables such as the current setting of the locale, or the number of bit-
planes available on a screen. Most applications can use the higher-level function XtResolvePathname() which provides a number of standard
substitutions and a default path.
The default predicate procedure is sufficient for most uses. An application that wanted to find a directory rather than a file, for exam-
ple, would have to specify a custom predicate, as would an application that wanted to verify that a file was readable and that the contents
of the file were reasonable would also have to provide a custom predicate procedure.
Background
There are two substitution sequences that are treated specially:
o The character sequence %: (percent colon) specifies an embedded colon that is not a delimiter; the sequence is replaced by a single
colon.
o The character sequence %% (percent percent) specifies a percent character that does not introduce a substitution; the sequence is
replaced by a single percent character.
A substitution string entry of NULL is equivalent to a pointer to an empty string.
If the operating system does not interpret multiple embedded name separators in the path (i.e., "/" in POSIX) the same way as a single sep-
arator, XtFindFile() will collapse multiple separators into a single one after performing all string substitutions. Except for collapsing
embedded separators, the contents of the string substitutions are not interpreted by XtFindFile() and may therefore contain any operating-
system-dependent characters, including additional name separators.
Structures
The Substitution type is defined as follows:
typedef struct {
char match;
String substitution;
} SubstitutionRec, *Substitution;
See Also
XtResolvePathname(1),
XtFilePredicate(2).
Xt - File Searching XtFindFile()