I want to use find to locate files with two different extensions, and run a grep on the results. The closest I have gotten is incredibly slow and ugly:
for i in `ls -laR|egrep -e '(.js|.css)'`; do find . -name $i -print|xargs grep -H searchBg; done;
This method makes my eyes bleed. Help! ;)
... (2 Replies)
I have one file which first line is blank and second line has some data.
$cat filename
output:
30-MAY-07
I want to store 30-MAY-07 value in one variable.
for that I wrote
var="`head -2 filename`"
It will give that result but I want to truncate the first line which is blank.
plz help. (2 Replies)
I am trying to concatenate 2 files, but before concatenation, I would like to strip off the final character from the first file.
The final character is a form feed (ascii 012 / hex 0C) and there will be an unknown number of these characters in the file. It is only the very last one which I want... (1 Reply)
I posted this already in another thread, but was told that I should create a seperate thread for the following question:
How do I strip the extension when the delimiter might occur multiple times in the filename?
For example:
I have 2 files as input for my script.
test.extension... (8 Replies)
Friends
I want to automat sending a letter to different persons whose directories are named as 001, 002, 003, 004.
To push the same letter to all these directories, I need to name the letter as letter.001, letter.002 like that.
Is there any method whereby I get the extension of this letter... (2 Replies)
I copied some files to another folder, and I want to change them from .doc extensions to .txt extensions. I tried using the cp and mv commands, but it didn't work. Is it possible to change file extensions with these commands, and if so how do I do it? I tried using the * wildcard (say cp *.doc... (1 Reply)
Hello all.
I would like to make a script (or two shell scripts) that will do the following.
I need the maximum file name and directory name to be 38 characters long.
As well, if shortening the file name ends up making all of the files in that directory have the same name, then I would like... (9 Replies)
HI,
I have some csv files with mutiple extensions, I want to remove all the extensions and keep only the .csv extension.
anybody can suggest me how to do this.
source files
1.txt.csv.txt.csv.csv.txt.csv
2.csv.txt.csv.txt.csv.txt
target
1.csv
2.csv
--Wang (1 Reply)
Here is a simplified example of my problem. Say I have the following 3 sub-directories;
./folder1
A.txt
A.sh
./folder2
B.txt
./folder3
C.txt
C.sh
I would like to list the directory names which contain both '.txt' & '.sh' type extensions. I have came up with the following code;... (8 Replies)
Discussion started by: mmab
8 Replies
LEARN ABOUT PHP
numfmt_parse
NUMFMT_PARSE(3) 1 NUMFMT_PARSE(3)NumberFormatter::parse - Parse a number
Object oriented style
SYNOPSIS
public mixed NumberFormatter::parse (string $value, [int $type], [int &$position])
DESCRIPTION
Procedural style
mixed numfmt_parse (NumberFormatter $fmt, string $value, [int $type], [int &$position])
Parse a string into a number using the current formatter rules.
PARAMETERS
o $fmt
-NumberFormatter object.
o $type
- The formatting type to use. By default, NumberFormatter::TYPE_DOUBLE is used.
o $position
- Offset in the string at which to begin parsing. On return, this value will hold the offset at which parsing ended.
RETURN VALUES
The value of the parsed number or FALSE on error.
EXAMPLES
Example #1
numfmt_parse(3) example
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
$num = "1.234.567,891";
echo numfmt_parse($fmt, $num)."
";
echo numfmt_parse($fmt, $num, NumberFormatter::TYPE_INT32)."
";
?>
Example #2
OO example
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
$num = "1.234.567,891";
echo $fmt->parse($num)."
";
echo $fmt->parse($num, NumberFormatter::TYPE_INT32)."
";
?>
The above example will output:
1234567.891
1234567
SEE ALSO numfmt_get_error_code(3), numfmt_format(3), numfmt_parse_currency(3).
PHP Documentation Group NUMFMT_PARSE(3)