What do you want to do with the very long SQL statements? Do you want to indent them on second/third lines?
BTW: This is what perl was designed for:
pipe the output of awk into this program and save as your report. It will look real pretty
If you need more help with formatting, do man perlform
---------- Post updated at 06:45 PM ---------- Previous update was at 06:38 PM ----------
Jack, here's a break-down of the awk command:
In awk, NR is the total input lines seen, while FNR is the number of input lines seen in the current file. So this essentially means: if we're processing the first file, "do this" (the code in the first set of braces {...}).
That code sets an associate array to the value of the 2nd column (in the first file, remember), where the index is the 1st column -- which is common in both files.
Now do a "next" which means do not process any more code for the current line. This ensures the rest of the awk script is not executed for the first file.
So the first "pattern/program" applies to the first file -- and only the first -- while the second "pattern/program" applies to the second (and subsequent) file(s).
The second pattern/program looks at each line (in the second file) and if the first column is found in the array A, and if the value is not null or not blank, it runs the portion between the braces.
The code in the braces simply replaces the 5th field of that line with the contents of what was seen in line indexed by the first column in the first file.
Hi guys I want to print the values by using this script but its giving the no of rows and columns as input instead of values
Would you plz help me on this
FILE- chr1.txt
1981 1
1971 1
1961 1
1941 1
perl script
#!/usr/bin/perl -w
$infile1 = 'chr1.txt';
$outfile3 = 'out3.txt';
... (3 Replies)
I have read another post about this issue and am wondering how to adapt it
to my own, much simpler, issue.
I have a file of user IDs like so:
333333
321321
546465
...etc
I need to take each number and use it to print records wherein the 5th
field matches the user ID pulled from the... (2 Replies)
Hi, Guys. Please help me to find solution to this problem using shell scripting.
I have an INPUT file with 4 columns separated by tab. Each block of records is separated by -----
-----
Sample1 5402 6680 Pattern01
Sample2 2216 2368 Pattern02... (6 Replies)
Hi everyone,
I have file1 and file2 comma separated both.
file1 is:
Header1,Header2,Header3,Header4,Header5,Header6,Header7,Header8,Header9,Header10
Code7,,,,,,,,,
Code5,,,,,,,,,
Code3,,,,,,,,,
Code9,,,,,,,,,
Code2,,,,,,,,,file2... (17 Replies)
Hello Friends,
I have a CDR file and i need to print out 2 columns with their field position which matches to some constant values,
a part of input file
CZ=1|CZA=1|DIAL=415483420001|EE=13|ESF=1|ET=|FF=0|9|MNC=99|MNP=9041|MTC=0|NID=2|NOA=international|ON=1|
OutPut
... (3 Replies)
Hi Experts,
I am trying to get the output from a matching pattern but unable to construct the awk command:
file :
aa bb cc 11
dd aa cc 33
cc 22 45 68
aa 33 44 44
dd aa cc 37
aa 33 44 67
I want the output to be : ( if $1 match to "aa" start of the line,then print $4 of that line, and... (3 Replies)
Hello,
I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
I want to print only the lines in file2 that match file1, in the same order as they appear in file 1
file1
file2
desired output:
I'm getting the lines to match
awk 'FNR==NR {a++}; FNR!=NR && a' file1 file2
but they are in sorted order, which is not what I want:
Can anyone... (4 Replies)
I would like to compare values in column 8, and grep the ones where the different is > 1, columns 1 and 2 are the key for array.
Every 4 rows the records values in columns 1 and 2 changed. Then, the comparison in the column 8 need to be done for the 4 rows everytime columns 1 and 2 changed
... (4 Replies)
Discussion started by: jiam912
4 Replies
LEARN ABOUT DEBIAN
gfs_tool
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)