Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Redirect Query o/p to variable Post 302220567 by joeyg on Friday 1st of August 2008 06:48:50 AM
Old 08-01-2008
Hammer & Screwdriver One way to do is

Code:
my_var=$(wc -l my_filename)

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

please help: how to redirect input into a variable

I'm trying to write a simple script program (C shell). I have a problem redirecting input into a variable. Say I have a variable called J, and there is file called result which contains just some number, say 5. Which command should I use to assign J value 5 from the file result. I tried the... (2 Replies)
Discussion started by: artur80
2 Replies

2. UNIX for Dummies Questions & Answers

Redirect Output In Variable

how make assign the output of the command (for example: grep "file" "string" ) in a variable ($name)? i thing how put the result of the command (grep , cut, find ecc) in a variable.. IT's Possible ?? (1 Reply)
Discussion started by: ZINGARO
1 Replies

3. UNIX for Dummies Questions & Answers

Redirect to variable

how do you redirect stdout into a variable. whenever I try I get an ambiguous redirect error :( I am trying to validate some user input and failing miserably. cal $MONTH $YEAR | grep -c "$DAY" if the above is 1 then it is valid if 0 then not valid. I have been trying to redirect the output... (2 Replies)
Discussion started by: MrAd
2 Replies

4. Shell Programming and Scripting

after grep i want to redirect it to some variable

for the below grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1 the result of the grep i want to redirect into some variable, i tried to do veri=grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1 but it is... (2 Replies)
Discussion started by: mail2sant
2 Replies

5. Shell Programming and Scripting

redirect cat to variable

hello just i saw a really strange for cat i have file (file1) contains line /home/rajiv/proj1/*.txt now applied a commonds DDPATH="$(cat file1)" echo $DDPATH it shows all the txt files in that folder like /home/rajiv/proj1/read1.txt /home/rajiv/proj1/read2.txt... (7 Replies)
Discussion started by: shailesh_arya
7 Replies

6. Shell Programming and Scripting

Redirect Postgresql Select Query to Variable

How to redirect postgresql select query to a variable using shell scripts? I tried to use psql -c "select ip from servers" db | egrep '+\.+\+\+' | sed 's/^ *\(.*\) *$/\1/' Output: 10.10.10.180 10.10.10.181 It display ip addresses from the databasem, but how could i redirect the... (3 Replies)
Discussion started by: uativan
3 Replies

7. Shell Programming and Scripting

add the output of a query to a variable to be used in another query

I would like to use the result of a query in another query. How do I redirect/add the output to another variable? $result = odbc_exec($connect, $query); while ($row = odbc_fetch_array($result)) { echo $row,"\n"; } odbc_close($connect); ?> This will output hostnames: host1... (0 Replies)
Discussion started by: hazno
0 Replies

8. UNIX for Dummies Questions & Answers

how to - redirect query results to a variable

How can I send the results of a query to a unix variable. I basically want to run a query then do some logic on the results. Trying to redirect the result into a variable I define in the script. select count(*) as counter from table - nut to redirect the "count" returned from the query... (2 Replies)
Discussion started by: rstone
2 Replies

9. Shell Programming and Scripting

redirect frintf to a variable

how to redirect printf to a variable (8 Replies)
Discussion started by: robo
8 Replies

10. Shell Programming and Scripting

Redirect Variable Value to a File

I have shell script generate.sh that has var="HP-UX" I am following example 19-8 in the below document. Here Documents The output.txt is generated however I want the value of variable var to be reflected in the contents of the output.txt file cat <<'EOF' #!/bin/bash connect("Welcome... (1 Reply)
Discussion started by: mohtashims
1 Replies
RDF::Query::Algebra::Offset(3pm)			User Contributed Perl Documentation			  RDF::Query::Algebra::Offset(3pm)

NAME
RDF::Query::Algebra::Offset - Algebra class for offseting query results VERSION
This document describes RDF::Query::Algebra::Offset version 2.908. METHODS
Beyond the methods documented below, this class inherits methods from the RDF::Query::Algebra class. "new ( $pattern, $offset )" Returns a new Sort structure. "construct_args" Returns a list of arguments that, passed to this class' constructor, will produce a clone of this algebra pattern. "pattern" Returns the pattern to be sorted. "offset" Returns the offset number of the pattern. "sse" Returns the SSE string for this algebra expression. "as_sparql" Returns the SPARQL string for this algebra expression. "as_hash" Returns the query as a nested set of plain data structures (no objects). "type" Returns the type of this algebra expression. "referenced_variables" Returns a list of the variable names used in this algebra expression. "potentially_bound" Returns a list of the variable names used in this algebra expression that will bind values during execution. "definite_variables" Returns a list of the variable names that will be bound after evaluating this algebra expression. "is_solution_modifier" Returns true if this node is a solution modifier. AUTHOR
Gregory Todd Williams <gwilliams@cpan.org> perl v5.14.2 2012-01-31 RDF::Query::Algebra::Offset(3pm)
All times are GMT -4. The time now is 08:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy