Sponsored Content
Top Forums Shell Programming and Scripting Cannot pass rsh and awk command into a variable Post 302753897 by elcounto on Wednesday 9th of January 2013 02:49:28 PM
Old 01-09-2013
Haha true, well spotted.

I'd still like to know how to do it though, just for closure.

Thanks
P.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

pass variable to awk

i would like to pass a variable to awk wherein the variable comes from external loop. i tried this... let x=0 until test $x -eq 32 do cat file | awk '{ print $1 , "Number" , $($x) }' >> output done thanks, (4 Replies)
Discussion started by: inquirer
4 Replies

2. Shell Programming and Scripting

can I pass awk variable to system command?

I wanna use a system function to deal with several data. So I use awk variable FILENAME to transfer the file directory to system command, but it does not work. I use a shell function "out_function" to deal with data and save the result in another directory with the same file name. How can I... (2 Replies)
Discussion started by: zhynxn
2 Replies

3. Shell Programming and Scripting

How to pass a variable to Awk ?

I am trying to pass 2 shell variable's ("START" and "END") define earlier in the script to this awk statement, but i can't seem to pass it on. PLs help. set START = xxxx set END = yyyy set selected_file = `awk '/$START/,/$END/' filename` (24 Replies)
Discussion started by: Raynon
24 Replies

4. UNIX for Dummies Questions & Answers

How do I pass a variable to awk?

I have an awk statement where I Need to pass an environment variable but I cannot get it to work: My evironment varible examples below: $FILE1=/dev/fs/file.new $FILE2=/dev/fs/file.old Code below: awk -F"|" ' BEGIN { while( getline < "$FILE1" ) { arr=1 } } arr != 1 { print } '... (12 Replies)
Discussion started by: eja
12 Replies

5. Shell Programming and Scripting

Pass script variable value to AWK

HI all, some more mistery about AWK, I hope you can help me out: 1) I have a normal ksh script and sometime I call awk command. I set some variables in the script and I would like to use them up within AWK as well. Unfortunately AWK seems to forget all the variable values outside of its own... (1 Reply)
Discussion started by: BearCheese
1 Replies

6. Shell Programming and Scripting

how to pass variable in NR function used in awk command?

Hi I want to pass variables with the NR function in awk command. test_file1 is input file having 500 records. var1=100. var2=200 awk -F" " 'NR >= $var1 && NR <= $var2' test_file1 > test_file2. My end result should be that test_file2 should have records from line number between... (2 Replies)
Discussion started by: Nishithinfy
2 Replies

7. Shell Programming and Scripting

awk, double variable, for loop and rsh

Hello folks, I've a (perhaps) simple question. In a text file I've : server_name1: directory1 server_name2: directory2 server_name3: directory3 I want to make a loop that lets me connect and operate on every server: rsh server_name1 "ls -l directory1" I've tried with awk,... (6 Replies)
Discussion started by: gogol_bordello
6 Replies

8. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

9. UNIX for Advanced & Expert Users

Pass variable to awk command search string

I must have forgot how to do this, but, I am attempting to enter a variable into an awk / gawk search pattern. I am getting a value from user input to place in a specific section of a 132 character string. my default command is .... gawk --re-interval '/^(.{3}P .{4}CYA.{8}1)/' ... (3 Replies)
Discussion started by: sdeevers
3 Replies

10. UNIX for Beginners Questions & Answers

Need to pass variable in a command and assign value to a variable

Hello All, Hope you're doing well ! I am trying below command to be passed in a shell script, header_date_14 is a variable and $1 is the name of a file I intend to pass as a command line argument, however command line argument is not being accepted. header_date_14=$(m_dump... (8 Replies)
Discussion started by: ektubbe
8 Replies
Graph::TransitiveClosure::Matrix(3pm)			User Contributed Perl Documentation		     Graph::TransitiveClosure::Matrix(3pm)

NAME
Graph::TransitiveClosure::Matrix - create and query transitive closure of graph SYNOPSIS
use Graph::TransitiveClosure::Matrix; use Graph::Directed; # or Undirected my $g = Graph::Directed->new; $g->add_...(); # build $g # Compute the transitive closure matrix. my $tcm = Graph::TransitiveClosure::Matrix->new($g); # Being reflexive is the default, # meaning that null transitions are included. my $tcm = Graph::TransitiveClosure::Matrix->new($g, reflexive => 1); $tcm->is_reachable($u, $v) # is_reachable(u, v) is always reflexive. $tcm->is_reachable($u, $v) # The reflexivity of is_transitive(u, v) depends of the reflexivity # of the transitive closure. $tcg->is_transitive($u, $v) my $tcm = Graph::TransitiveClosure::Matrix->new($g, path_length => 1); my $n = $tcm->path_length($u, $v) my $tcm = Graph::TransitiveClosure::Matrix->new($g, path_vertices => 1); my @v = $tcm->path_vertices($u, $v) my $tcm = Graph::TransitiveClosure::Matrix->new($g, attribute_name => 'length'); my $n = $tcm->path_length($u, $v) my @v = $tcm->vertices DESCRIPTION
You can use "Graph::TransitiveClosure::Matrix" to compute the transitive closure matrix of a graph and optionally also the minimum paths (lengths and vertices) between vertices, and after that query the transitiveness between vertices by using the "is_reachable()" and "is_transitive()" methods, and the paths by using the "path_length()" and "path_vertices()" methods. If you modify the graph after computing its transitive closure, the transitive closure and minimum paths may become invalid. Methods Class Methods new($g) Construct the transitive closure matrix of the graph $g. new($g, options) Construct the transitive closure matrix of the graph $g with options as a hash. The known options are "attribute_name" => attribute_name By default the edge attribute used for distance is "w". You can change that by giving another attribute name with the "attribute_name" attribute to the new() constructor. reflexive => boolean By default the transitive closure matrix is not reflexive: that is, the adjacency matrix has zeroes on the diagonal. To have ones on the diagonal, use true for the "reflexive" option. NOTE: this behaviour has changed from Graph 0.2xxx: transitive closure graphs were by default reflexive. path_length => boolean By default the path lengths are not computed, only the boolean transitivity. By using true for "path_length" also the path lengths will be computed, they can be retrieved using the path_length() method. path_vertices => boolean By default the paths are not computed, only the boolean transitivity. By using true for "path_vertices" also the paths will be computed, they can be retrieved using the path_vertices() method. Object Methods is_reachable($u, $v) Return true if the vertex $v is reachable from the vertex $u, or false if not. path_length($u, $v) Return the minimum path length from the vertex $u to the vertex $v, or undef if there is no such path. path_vertices($u, $v) Return the minimum path (as a list of vertices) from the vertex $u to the vertex $v, or an empty list if there is no such path, OR also return an empty list if $u equals $v. has_vertices($u, $v, ...) Return true if the transitive closure matrix has all the listed vertices, false if not. is_transitive($u, $v) Return true if the vertex $v is transitively reachable from the vertex $u, false if not. vertices Return the list of vertices in the transitive closure matrix. path_predecessor Return the predecessor of vertex $v in the transitive closure path going back to vertex $u. RETURN VALUES
For path_length() the return value will be the sum of the appropriate attributes on the edges of the path, "weight" by default. If no attribute has been set, one(1) will be assumed. If you try to ask about vertices not in the graph, undefs and empty lists will be returned. ALGORITHM
The transitive closure algorithm used is Warshall and Floyd-Warshall for the minimum paths, which is O(V**3) in time, and the returned matrices are O(V**2) in space. SEE ALSO
Graph::AdjacencyMatrix AUTHOR AND COPYRIGHT
Jarkko Hietaniemi jhi@iki.fi LICENSE
This module is licensed under the same terms as Perl itself. perl v5.10.0 2009-01-17 Graph::TransitiveClosure::Matrix(3pm)
All times are GMT -4. The time now is 09:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy