Hi Guys,
I am trying to compare using if, but keep getting some strange results.
if ; then
keeps creating the file 1
if ; then
does not work at all
if ; then
does not work
if ; then
does not work
if ; then
does not work eihter.
I am using a ksh, on Solaris (9 Replies)
Hi Guys,
I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same.
can anyone of you please let me know how to go about it ? (8 Replies)
Can someone tell me how I can do this?
e.g:
a=$(echo -e wert trewt ertert ertert ertert erttert
erterte
rterter
tertertert
ert)
How do i replace the STRING with $a?
I try this:
sed -i 's/STRING/'"$a"'/g' filename.ext
but this don' t work (2 Replies)
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)
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Hi,
I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB and add/replace... (1 Reply)
I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file.
Please use CODE tags as... (7 Replies)
I will start with an example of what I'm trying to do and then describe how I am approaching the issue.
File
PS028,005
Lexeme HRS # M #
PhraseType 1(1:1) 7(7)
PhraseLab 501 503
ClauseType ZYq0
PS028,005
Lexeme W # L> # BNH # M #... (17 Replies)
Discussion started by: jvoot
17 Replies
LEARN ABOUT PHP
strnatcmp
STRNATCMP(3) 1 STRNATCMP(3)strnatcmp - String comparisons using a "natural order" algorithm
SYNOPSIS
int strnatcmp (string $str1, string $str2)
DESCRIPTION
This function implements a comparison algorithm that orders alphanumeric strings in the way a human being would, this is described as a
"natural ordering". Note that this comparison is case sensitive.
PARAMETERS
o $str1
- The first string.
o $str2
- The second string.
RETURN VALUES
Similar to other string comparison functions, this one returns < 0 if $str1 is less than $str2; > 0 if $str1 is greater than $str2, and 0
if they are equal.
EXAMPLES
An example of the difference between this algorithm and the regular computer string sorting algorithms (used in strcmp(3)) can be seen
below:
<?php
$arr1 = $arr2 = array("img12.png", "img10.png", "img2.png", "img1.png");
echo "Standard string comparison
";
usort($arr1, "strcmp");
print_r($arr1);
echo "
Natural order string comparison
";
usort($arr2, "strnatcmp");
print_r($arr2);
?>
The above example will output:
Standard string comparison
Array
(
[0] => img1.png
[1] => img10.png
[2] => img12.png
[3] => img2.png
)
Natural order string comparison
Array
(
[0] => img1.png
[1] => img2.png
[2] => img10.png
[3] => img12.png
)
SEE ALSO preg_match(3), strcasecmp(3), substr(3), stristr(3), strcmp(3), strncmp(3), strncasecmp(3), strnatcasecmp(3), strstr(3), natsort(3), nat-
casesort(3).
PHP Documentation Group STRNATCMP(3)