10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello, new to the forums and to awk. Glad to be here. :o
I want to pass two shell (#!/bin/sh) variables through to awk and use them. They will determine where to start and stop text extraction.
The code with the variables hard-coded in awk works fine; the same code, but with the shell... (7 Replies)
Discussion started by: bedtime
7 Replies
2. Shell Programming and Scripting
Am looking to pass some Linux environment variables into AWK , can I simply use the -v option ?
awk -F: -v AHOME=$HOME '{ if
{rm AHOME/file.txt
a=2 } }'
config.txt
... (4 Replies)
Discussion started by: alldbest
4 Replies
3. Shell Programming and Scripting
Trying to do so
echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
Iam trying to pass global shell variables and is not working
Main script is like below
CYEAR=`date +"%y"`
CFYEAR=`date +"%Y"`
CMONTH=`date +"%m"`
if
then
PMONTH=12
PYEAR=`expr $CYEAR - 1`
PFYEAR=`expr $CFYEAR - 1`
else
PMONTH=`expr... (6 Replies)
Discussion started by: baanprog
6 Replies
5. Shell Programming and Scripting
Hi guys,
I need to fetch data from logfile between two given dates,i got the below code from our forum.It works perfect,but i need to enter the value dynamically to awk while running.
awk '/2012 Jun/{p=1}!/2012 Jul/ && prev~/2012 Jul/ && p{p=0}{prev=$0}p' file
i tried the below code,but... (4 Replies)
Discussion started by: mohanalakshmi
4 Replies
6. Shell Programming and Scripting
I'm trying to use awk to write new entries to a hosts file if they don't exist. I need to do so depending on the type of system I have. Below is what I have, but it isn't working.
awk -v myip1=$IP1 myip2=$IP2 myhost1=$HOST1 myhost2=$HOST2' BEGIN { mqhost1=0; mqhost2=0; stap1=0; stap2=0; }
... (4 Replies)
Discussion started by: Boomn4x4
4 Replies
7. Shell Programming and Scripting
Using ksh to call a function which has awk script embedded.
It parses a long two element list file, filled with text numbers (I want column 2, beginning no sooner than line 45, that's the only known thing) . It's unknown where to start or end the data collection, dynamic variables will be used. ... (1 Reply)
Discussion started by: highnthemnts
1 Replies
8. Shell Programming and Scripting
Hi.
I need to parse file and assign some values to variables, right now i do like below
MYHOMEDIR=`awk '/Home/ {print $NF}' output.txt`
MYSHELL=`awk '/Shell/ {print $NF}' output.txt`
PRGRP=`awk '/Primary/ {print $NF}' output.txt`
SECGRP=`awk '/Second/ {print $NF}' output.txt`
In this... (10 Replies)
Discussion started by: urello
10 Replies
9. Shell Programming and Scripting
I noticed my script is not passing the value of variable alert to the rsh command. I need some assistance, please. This is a solaris environement. Thanks! :confused:
#!/bin/sh
echo -n "Alert number:"
read alert
rsh rhost_name 'egrep $alert /opt/var/log/*.logs' (2 Replies)
Discussion started by: lopus
2 Replies
10. Shell Programming and Scripting
Hello,
Can we pass shell variables like $PATH etc. to a awk program part
for example,
awk ' {
fieldValue=$PATH
....
}' file (1 Reply)
Discussion started by: Vishnu
1 Replies
gfs_tool(8) System Manager's Manual gfs_tool(8)
NAME
gfs_tool - interface to gfs ioctl calls
SYNOPSIS
gfs_tool COMMAND [OPTION] [PARAMETERS ...]
DESCRIPTION
gfs_tool is an interface to a variety of the GFS ioctl calls.
Specifying gfs_tool -h prints gfs_tool command line usage (help).
Specifying gfs_tool -V prints the gfs_tool version information.
COMMANDS
clearflag Flag File1 File2 ...
Clear an attribute flag on a file.
counters MountPoint [-c] [-i interval]
Print out statistics about a filesystem. If -c is specified, gfs_tool keeps running printing out the statistics once per second or,
if specified, the interval given with the -i option, in seconds.
df MountPoint [-k]|[-H]
Print out a space usage summary of a given filesystem. The information printed is more detailed than a standard "df". If -k is
specified, the output is given in kilobytes (KB). If -H is specified, the output is given in human readable format (similar to df
-h). If neither -k nor -H are specified, the output is given in file system blocks.
freeze MountPoint
Freeze (quiesce) a GFS cluster.
getsb MountPoint
Print out the superblock of a mounted filesystem.
gettune MountPoint
Print out the current values of the tuning parameters in a running filesystem.
jindex MountPoint
Print out the journal index of a mounted filesystem.
layout File [buffersize]
Print out on-disk layout information about a file or directory. Buffersize is the size of the buffer (in bytes) that gfs_tool allo-
cates to store the file's metadata during processing. It defaults to 4194304 bytes. If you are printing a very big directory you
may need to specify a bigger size.
list List the currently mounted GFS filesystems. Each line represents a filesystem. The columns represent (in order): 1) A number that
is a cookie that represents the mounted filesystem. 2) The name of the device that holds the filesystem (well, the name as the Linux
kernel knows it). 3) The lock table field that the filesystem was mounted with.
lockdump MountPoint [buffersize]
Print out information about the locks this machine holds for a given filesystem. Buffersize is the size of the buffer (in bytes)
that gfs_tool allocates to store the lock data during processing. It defaults to 4194304 bytes.
margs arguments
This loads arguments into the module what will override the mount options passed with the -o field on the next mount. See
mount.gfs(8).
reclaim File
Returns unused on-disk metadata blocks to free blocks.
rindex MountPoint
Print out the resource group index of a mounted filesystem.
quota MountPoint
Print out the quota file of a mounted filesystem. Also see the "gfs_quota list" command.
sb device proto [newvalue]
View (and possibly replace) the name of the locking protocol in the file system superblock. The file system shouldn't be mounted by
any client when you do this.
sb device table [newvalue]
View (and possibly replace) the name of the locking table in the file system superblock. The file system shouldn't be mounted by
any client when you do this.
sb device ondisk [newvalue]
View (and possibly replace) the ondisk format number in the file system superblock. The file system shouldn't be mounted by any
client when you do this. No one should have to use this.
sb device multihost [newvalue]
View (and possibly replace) the multihost format number in the file system superblock. The file system shouldn't be mounted by any
client when you do this. No one should have to use this.
sb device all
Print out the superblock.
setflag Flag File1 File2 ...
Set an attribute flag on a file. There are four currently supported flags. They are jdata, directio, inherit_jdata, and
inherit_directio.
The jdata flag causes all the data written to a regular file to be journaled. The jdata flag can only be set (or cleared) if the
file is zero length.
The directio flag causes all I/O to a regular file to be Direct I/O, even if the O_DIRECT flag isn't used on the open() command.
The inherit_jdata flag is set on a directory. It causes all new regular files created in that directory automatically inherit the
jdata flag. The inherit_jdata is also inherited by any new subdirectories created in that directory.
The inherit_directio flag is set on a directory. It causes all new regular files created in that directory automatically inherit
the directio flag. The inherit_directio is also inherited by any new subdirectories created in that directory.
settune MountPoint parameter newvalue
Set the value of tuning parameter. Use gettune for a listing of tunable parameters.
shrink MountPoint
Causes any unused inodes to be thrown out of memory.
stat File
Print out extended stat information about a file.
unfreeze MountPoint
Unfreeze a GFS cluster.
version
Print out the version of GFS that this program goes with.
withdraw MountPoint
Cause GFS to abnormally shutdown a given filesystem on this node.
gfs_tool(8)