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
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT FREEBSD
version.4th
VERSION.4TH(8) BSD System Manager's Manual VERSION.4TH(8)
NAME
version.4th -- FreeBSD version string boot module
DESCRIPTION
The file that goes by the name of version.4th is a set of commands designed to draw the boot loader version at the bottom-right of the
screen. The commands of version.4th by themselves are not enough for most uses. Please refer to the examples below for the most common sit-
uations, and to loader(8) for additional commands.
Before using any of the commands provided in version.4th, it must be included through the command:
include version.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:
print_version Prints the contents of the loader_version environment variable right-justified at the column loader_version_x
and row loader_version_y.
The environment variables that effect its behavior are:
loader_version
Set automatically by loader(8), but you can override it by setting in loader.conf(5). This should be the version of boot
loader used.
loader_version_x
Sets the desired ending column position of loader_version. Default is 80.
loader_version_y
Sets the desired ending row position of loader_version. Default is 24.
loader_color
If set to ``NO'' (case-insensitive) or ``0'', causes the version to be printed without color (default is ANSI Cyan).
FILES
/boot/loader The loader(8).
/boot/version.4th version.4th itself.
/boot/loader.rc loader(8) bootstrapping script.
EXAMPLES
Override loader(8) version in loader.conf(5):
loader_version="loader 1.1"
SEE ALSO
loader.conf(5), color.4th(8), loader(8)
HISTORY
The version.4th set of commands first appeared in FreeBSD 9.0.
AUTHORS
The version.4th set of commands was written by Devin Teske <dteske@FreeBSD.org>.
BSD
August 6, 2013 BSD