Sponsored Content
Top Forums Shell Programming and Scripting Saving output from awk into a perl variable Post 302244923 by otheus on Thursday 9th of October 2008 03:29:35 AM
Old 10-09-2008
Absolutely. Are you looking for exactly one line, or more? Are the columns separated by whitespace? Assuming yes to all the answers above:
Code:
my $target;
if (open(FOO,$_)) { 
 while ($_=<FOO>) { 
   next unless /OXT/;  # find OXT anywhere in line.
   $target=(split)[4];
   last;
 }
 close(FOO); # forgot this last time, though not really necessary.
}
# 4th field in $target

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

saving awk value in a bash array variable

hi all i am trying to save an awk value into an array in bash: total=`awk '{sum+=$3} END {print sum}' "$count".txt"` ((count++)) the above statement is in a while loop.. $count is to keep track of file numbers (1.txt,2.txt,3.txt,etc.) i get the following error: ./lines1:... (1 Reply)
Discussion started by: npatwardhan
1 Replies

2. UNIX for Dummies Questions & Answers

saving command output to a variable

Hello, I have a shell script containing a command string in the following format: command1 | command2 | cut -c9-16 The output from this is a record number (using characters 9-16 of the original output string) e.g. ORD-1234 I wish to save this value to a variable for use in later commands... (4 Replies)
Discussion started by: philjo
4 Replies

3. Shell Programming and Scripting

Piping and assigning output to a variable in Perl

Hi All, I am trying to convert the below Csh code into Perl. But i have the following error. Can any expert help ? Error: ls: *tac: No such file or directory Csh set $ST_file = `ls -rt *$testid*st*|tail -1`; Perl my $ST_file = `ls -rt *$testid*st*|tail -1`; (10 Replies)
Discussion started by: Raynon
10 Replies

4. Shell Programming and Scripting

Assign perl output to ksh shell variable

Hello, I am writing a ksh script on an AIX system. I need to get the date and time from a file into a variable. I found the following perl script from another post on this site and modified it slightly to output the format I need: perl -e '@d=localtime ((stat(shift)));... (4 Replies)
Discussion started by: swimp
4 Replies

5. Shell Programming and Scripting

using awk for setting variable but change the output of this variable within awk

Hi all, Hope someone can help me out here. I have this BASH script (see below) My problem lies with the variable path. The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level. The... (6 Replies)
Discussion started by: Cowardly
6 Replies

6. Shell Programming and Scripting

help on awk---- need to assign the output of awk to a variable

hi i want to find the size of a folder and assign it to a variable and then compare if it is greater than 1 gb. i am doin this script, but it is throwing error.... #!/bin/ksh cd . | du -s | size = awk '{print $1}' if size >= 112000 then echo size high fi ERROR : (4 Replies)
Discussion started by: Nithz
4 Replies

7. Shell Programming and Scripting

Perl help - how to assign output of perl to variable

Hi, guys, i have a script i inherited from a coworker but i'm not perl savy. The script works but i would like it to work better. I want to run this command ./ciscomgrtest.pl -r "show version" -h hosts.router and have the script goto each router in the hosts.router file and run the command... (2 Replies)
Discussion started by: whipuras
2 Replies

8. Shell Programming and Scripting

awk question : system output to awk variable.

Hi Experts, I am trying to get system output to capture inside awk , but not working: Please advise if this is possible : I am trying something like this but not working, the output is coming wrong: echo "" | awk '{d=system ("date") ; print "Current date is:" , d }' Thanks, (5 Replies)
Discussion started by: rveri
5 Replies

9. Shell Programming and Scripting

awk - saving results of external script to variable.

So, I've been playing with speeding up some analysis we do by using multiple threads of awk (actually, mawk, but code-compatible as far as I use it) on multiple CPU cores. So, I have a big data file and I have several copies of exactly the same processor script, written in mawk. I also have a... (8 Replies)
Discussion started by: treesloth
8 Replies

10. UNIX for Beginners Questions & Answers

Using variable output in awk

Hi, I am trying to use variable output in awk to append a string to a word in a line. But that is not happening. Could you please help me on this. YouTube Video Tutorial: How to Use Code Tags and Format Posts @UNIX.com The below is the code #!/bin/ksh set -x src=/users/oracle/Temp... (2 Replies)
Discussion started by: pvmanikandan
2 Replies
GLBINDRENDERBUFFER(3G)						   OpenGL Manual					    GLBINDRENDERBUFFER(3G)

NAME
glBindRenderbuffer - bind a renderbuffer to a renderbuffer target C SPECIFICATION
void glBindRenderbuffer(GLenum target, GLuint renderbuffer); PARAMETERS
target Specifies the renderbuffer target of the binding operation. target must be GL_RENDERBUFFER. renderbuffer Specifies the name of the renderbuffer object to bind. DESCRIPTION
glBindRenderbuffer binds the renderbuffer object with name renderbuffer to the renderbuffer target specified by target. target must be GL_RENDERBUFFER. renderbuffer is the name of a renderbuffer object previously returned from a call to glGenRenderbuffers(), or zero to break the existing binding of a renderbuffer object to target. ERRORS
GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER. GL_INVALID_OPERATION is generated if renderbuffer is not zero or the name of a renderbuffer previously returned from a call to glGenRenderbuffers(). SEE ALSO
glGenRenderbuffers(), glDeleteRenderbuffers(), glRenderbufferStorage(), glRenderbufferStorageMultisample(), glIsRenderbuffer() COPYRIGHT
Copyright (C) 2010 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/. AUTHORS
opengl.org opengl.org 06/10/2014 GLBINDRENDERBUFFER(3G)
All times are GMT -4. The time now is 01:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy