Sponsored Content
Top Forums Shell Programming and Scripting Saving output from awk into a perl variable Post 302244922 by userix on Thursday 9th of October 2008 03:21:59 AM
Old 10-09-2008
I want to search for a number found in the 4th column on a specific line in a file and store that value into a variable. This file contains over 7000 lines of data. The specific line I am looking for contains the letters 'OXT' This is why I was thinking of using awk to find the line that contains 'OXT' and then grab the number from the 4th column of that line only. Would that work with split?
 

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
BRAND.4TH(8)						    BSD System Manager's Manual 					      BRAND.4TH(8)

NAME
brand.4th -- FreeBSD ASCII art boot module DESCRIPTION
The file that goes by the name of brand.4th is a set of commands designed to draw the ASCII art BSD brand above the boot loader menu. The commands of brand.4th by themselves are not enough for most uses. Please refer to the examples below for the most common situations, and to loader(8) for additional commands. Before using any of the commands provided in brand.4th, it must be included through the command: include brand.4th This line is present in the default /boot/menu.rc file, so it is not needed (and should not be re-issued) in a normal setup. The commands provided by it are: draw-brand Draws the BSD brand. The brand that is drawn is configured by setting the loader_brand variable in loader.conf(5) to one of ``fbsd'' (the default) or ``none''. The position of the logo can be configured by setting the loader_brand_x and loader_brand_y variables in loader.conf(5). The default values are 2 (x) and 1 (y). The environment variables that effect its behavior are: loader_brand Selects the desired brand in the beastie boot menu. Possible values are: ``fbsd'' (default) or ``none''. loader_brand_x Sets the desired column position of the brand. Default is 2. loader_brand_y Sets the desired row position of the brand. Default is 1. FILES
/boot/loader The loader(8). /boot/brand.4th brand.4th itself. /boot/loader.rc loader(8) bootstrapping script. EXAMPLES
Set FreeBSD brand in loader.conf(5): loader_brand="fbsd" SEE ALSO
loader.conf(5), loader(8) HISTORY
The brand.4th set of commands first appeared in FreeBSD 9.0. AUTHORS
The brand.4th set of commands was written by Devin Teske <dteske@FreeBSD.org>. BSD
May 18, 2011 BSD
All times are GMT -4. The time now is 05:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy