Sponsored Content
Full Discussion: How to apply brackets?
Top Forums Shell Programming and Scripting How to apply brackets? Post 302279562 by vanitham on Friday 23rd of January 2009 05:37:49 AM
Old 01-23-2009
How to apply brackets?

Hi,

I have a query term like this:

$query="apple NOT banana AND fruits";

$query="a1 NOT prim1 AND a2 NOT a3 OR a5";

I want to apply brackets to the NOT terms and the output should be like this:

Code:
$query="apple NOT (banana) AND fruits";
$query="a1 NOT (prim1) AND a2 NOT (a3) OR a5";

How can i do this??

Regards
Vanitha

Last edited by vanitham; 01-23-2009 at 07:01 AM..
 

10 More Discussions You Might Find Interesting

1. HP-UX

How to apply patches in HP-UX ?

Hi: One basic qs. how to apply patches in hp-ux ? Thanks in advance. (2 Replies)
Discussion started by: bbose
2 Replies

2. UNIX for Dummies Questions & Answers

ldapmodify: keystroke to apply changes

Hi, I need to modify some entries in LDAP, but with what keystroke do I exit and apply the changes? Thanks Brissix (0 Replies)
Discussion started by: brissix
0 Replies

3. UNIX for Dummies Questions & Answers

How to apply static ip address

Hi there, I have a Debian 5.0 server newly installed. By default, the ip address is given by dhcp. pegase:~# grep '^' /etc/network/interfaces auto lo iface lo inet loopback allow-hotplug eth0 iface eth0 inet dhcp pegase:~# head -2 /etc/hosts 127.0.0.1 localhost 127.0.1.1 ... (1 Reply)
Discussion started by: chebarbudo
1 Replies

4. Shell Programming and Scripting

Re-apply the file permission

Hi, I having an issue with file permission. To fix it I need to read the file's existing permission and re-apply the same permission to the file. This has to be done for every single file under a mount point. I'm novice in scripting. Help me with this in shell scripting. # ls -l /dev/null... (10 Replies)
Discussion started by: agent001
10 Replies

5. Shell Programming and Scripting

Get value between brackets

Hi I am having hard time getting this right and need some help. I Have several log files, and everyone contains the following 3 lines at the end: 4 ETW000 Disconnected from database. 4 ETW000 End of Transport (0000). 4 ETW000 date&time: 13.01.2011 - 08:03:28 I need to capture the value... (7 Replies)
Discussion started by: nimo
7 Replies

6. Shell Programming and Scripting

How to get the value in the first brackets

Hello, I am trying to write a script using ksh. And I want to get the value within the first brackets of a string. For example: 14/04/11 11:35: 00 This is (nn) from the earth. Then i hope to get nn in this case. Can any one advise me how to implement it? Thank you very much! nn (2 Replies)
Discussion started by: n_n
2 Replies

7. Shell Programming and Scripting

Delete text between square brackets and also delete those square brackets using sed or awk

Hi All, I have a text file which looks like this: computer programming systems engineering I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this: computer programming systems engineering I am using... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

8. Shell Programming and Scripting

Apply file permission

Hi All, I would like to read the permission from a file and wanted to apply the same permission to another file. say for example, f1 755 first...i have to read the permission type (which is differ for each file) and need to apply the same for f2 a1 666 i have to get this... (5 Replies)
Discussion started by: karthi_mrkg
5 Replies

9. Shell Programming and Scripting

Brackets

Hi all. i need a small help. i have written an exit code, which will check whether mo.sh is successful or not. if the status is >0 it will exit the shell. 1>Do you guys think it is a correct way to write? 2>what if i change the double bracket to single. how will it change the o/p. ... (1 Reply)
Discussion started by: sub
1 Replies

10. UNIX for Beginners Questions & Answers

How to apply acl?

hi, i am facing problem with acls, as a root i logged in and applied acl for directory(dir5),by using command setfacl -m u:user1:rwx dir5 but when i logged in as user1 i am not able to access that folder even though i applied full permission to that directory as a root.can any one help me on... (2 Replies)
Discussion started by: cmanoj489
2 Replies
ASORT(3)								 1								  ASORT(3)

asort - Sort an array and maintain index association

SYNOPSIS
bool asort (array &$array, [int $sort_flags = SORT_REGULAR]) DESCRIPTION
This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. PARAMETERS
o $array - The input array. o $sort_flags - You may modify the behavior of the sort using the optional parameter $sort_flags, for details see sort(3). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 asort(3) example <?php $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); asort($fruits); foreach ($fruits as $key => $val) { echo "$key = $val "; } ?> The above example will output: c = apple b = banana d = lemon a = orange The fruits have been sorted in alphabetical order, and the index associated with each element has been maintained. SEE ALSO
arsort(3), The comparison of array sorting functions. PHP Documentation Group ASORT(3)
All times are GMT -4. The time now is 10:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy