Sponsored Content
Top Forums Shell Programming and Scripting Results of command execution into array Post 302226381 by Annihilannic on Monday 18th of August 2008 11:14:29 PM
Old 08-19-2008
If your system supports process substitution:

Code:
IFS='\
' read -d'^Y' -a array < <(fdisk -l | grep 83 | grep Linux)

'^Y' is just a randomly chosen character that should not occur in the input data (entered using Ctrl-V Ctrl-Y).

Last edited by Annihilannic; 08-19-2008 at 01:00 AM.. Reason: process substitution, not named pipes
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

getting results after using ps command

Hi, I want to use the following ps coomand: ps -ef | grep test Result of this command is: Test 161220 1 0 Oct 04 - 1:11 /test/test Just mentioning the description of each value in the result: UID PID PPID C STIME TTY TIME CMD Test 161220... (11 Replies)
Discussion started by: yale_work
11 Replies

2. Shell Programming and Scripting

Compare Array results

Hi, In a kshell , i need to compare the results of two array . each Non-match value should copy to a new array. For example: ========== Array one contain the following values: A B C Array two contain the following values: C F A E After comparing this arrays , a new array should... (4 Replies)
Discussion started by: yoavbe
4 Replies

3. Shell Programming and Scripting

Results of "find" to an array

I am looking to search a directory for a folder or file and when it finds any hits I want it to store those hits in an array so I can work with those hits later on. I have been trying to do something like this but it isn't putting results into an array like I would like, is it syntax or is this... (8 Replies)
Discussion started by: tret
8 Replies

4. Shell Programming and Scripting

Adding results of a find to an array

I'm trying to add the paths of all the xml files in certain directories to an array. I want to use the array later in my code. Anyway, for some reason this isn't working. Any help would be appreciated. Path_Counter=0 for result in "find * -name '*.xml'"; do XmlPath="$result" echo... (2 Replies)
Discussion started by: Fly_Moe
2 Replies

5. Shell Programming and Scripting

Want to terminate command execution when string found in the command output

Hi Experts, I am very much new to linux scripting, I am currently working on reducing my manual work and hence writing a script to automate few task. I am running below command to snmpwalk the router.. snmpwalk -v 3 -u WANDL_SU -a MD5 -A vfipmpls -x DES -X VfIpMpLs -l authPriv... (19 Replies)
Discussion started by: Hanumant.madane
19 Replies

6. Shell Programming and Scripting

Echoing command results

Sorry folks, Second time today. I am working on a script that accepts data via pipe and processes it. I expect it to work as: # command | ProcScript.sh Within ProcScript.sh, I want to be able to give the target of the prev run command I am using history 2 | grep -v history | awk... (18 Replies)
Discussion started by: Marc G
18 Replies

7. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

8. Shell Programming and Scripting

Storing the SQL results in array variables

Requirement 1) I need to execute 15 SQL queries in oracle through linux script. All these query results needs to be stored in array variables. Requirement 2) And these 15 queries needs to be executed in parallel. Requirement 3) Once all the queries executed then the shell script should... (3 Replies)
Discussion started by: Niranjancse
3 Replies

9. Shell Programming and Scripting

Append awk results into file or array

for a in {1..100} do awk '{ sum+=$a} END {print sum}' a=$a file1 > file2 done I know I will get only one number if following the code above, how can I get 100 sum numbers in file2? (2 Replies)
Discussion started by: wanliushao
2 Replies

10. Programming

Results Of A Variable Into An Array Using C Language

Can C add its results into an array like bash? For example using bash: cat /etc/passwd **truncated for space ** gdm:x:109:118:Gnome Display Manager:/var/lib/gdm:/bin/false mysql:x:110:122:MySQL Server,,,:/nonexistent:/bin/false statd:x:111:65534::/var/lib/nfs:/bin/false... (5 Replies)
Discussion started by: metallica1973
5 Replies
MONGOCOMMANDCURSOR.REWIND(3)						 1					      MONGOCOMMANDCURSOR.REWIND(3)

MongoCommandCursor::rewind - Executes the command and resets the cursor to the start of the result set

SYNOPSIS
public array MongoCommandCursor::rewind (void ) DESCRIPTION
If the cursor has already started iteration, the command will be re-executed. PARAMETERS
This function has no parameters. RETURN VALUES
The raw server result document. ERRORS
/EXCEPTIONS Throws MongoConnectionException if it cannot reach the database and MongoCursorTimeoutException if the timeout is exceeded. Throws MongoCursorException if the cursor was created with MongoCommandCursor.createFromDocument(3) and has already started iteration. Such cursors cannot be iterated multiple times, as they lack the original command necessary for re-execution. EXAMPLES
Example #1 MongoCommandCursor.rewind(3) <?php $rawResult = $commandCursor->rewind(); // Command cursor is now reset to the start of the result set var_dump($rawResult); ?> The above example will output something similar to: array(2) { ["cursor"]=> array(3) { ["id"]=> object(MongoInt64)#5(1) { ["value"]=> string(12) "310050110216" } ["ns"]=> string(9) "demo.test" ["firstBatch"]=> array(1) { [0]=> array(2) { ["_id"]=> object(MongoId)#6(1) { ["$id"]=> string(24) "52f5691544670a8077b0dc51" } ["value"]=> string(2) "42" } } } ["ok"]=> float(1) } SEE ALSO
Iterator::rewind. PHP Documentation Group MONGOCOMMANDCURSOR.REWIND(3)
All times are GMT -4. The time now is 09:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy