awk GSUB read field values from multiple text files
My program run without error. The problem I am having.
The program isn't outputting field values with the column headers to file.txt.
Each of the column headers in file.txt has no data.
The output results in file.txt should show:
I realized the problem is gsub. I don't know enough about gsub to fix this
issue.
The first gsub stored the field value for MEMSIZE and second gsub
stored the field value for real time and the last gsub stored the field
value for SASFoundation. The field values for headers are outputted to file.txt
I got a file with contents are of the following format
...
2007-09-28 ./.passwwd1.sh.swp
2007-11-26 ./827-55.jpg
2007-09-28 ./argcheck.pl
...
I have to delete all the '-' in the "first field", ie. the date, not on the second field, which is the name of the file.
i.e.
required output
... (1 Reply)
Hi,
first, I have searched in the forum for this, but I could not find the right answer. (There were some similar threads, but I was not sure how to adapt the ideas.)
Anyway, I have a quite natural problem: Given are several text files. All files contain the same number of lines and the same... (3 Replies)
Hi all.
I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value.
cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile
This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Hello,
For the input file, I am trying to split those records which have multiple values seperated by '|' in the last input field, into multiple records and each record corresponds to the common input fields + one of the value from the last field.
I was trying with an example on this forum... (4 Replies)
Hi,
I am trying to execute this line
awk -F ";" -v OFS=";" '{gsub(/\./,",",$6); print}' FILE
but for multiple fields $6 $7 $8
Do you have a suggstion?
Tried:
awk -F ";" -v OFS="";"" "function GSUB( F ) {gsub(/\./,\",\",$F); print} { GSUB( 6 ); GSUB( 7 ); GSUB( 8 ) } 1"... (2 Replies)
Hi,
I am using the following code to change NA to X in only the 5th column of my text file:
awk '{gsub("NA","x",$5)}1' in.file > out.file
How can I modify this code if I want to change NA to X in multiple columns of the text file (i.e. columns 5,6 and 7). Thanks! (2 Replies)
Hi,
I have a huge file that has data something like shown below:
huge_file.txt
start regexp
Name=Name1
Title=Analyst
Address=Address1
Department=Finance
end regexp
some text
some text
start regexp
Name=Name2
Title=Controller
Address=Address2
Department=Finance
end regexp (7 Replies)
I'm trying to use awk to do the following. I have file1 with many lines, each containing 5 fields describing an individual set. I have file2 which is a template config file with variable space holders to be replaced by the values in file1. I would like to substitute each set of values in file1 with... (6 Replies)
I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables.
I need to read this file which is an input to my script
Config.txt
file name, first path, second... (7 Replies)
I have several problems with my problems: I hope you can help me.
1) the If else statement I am getting an error message. My syntax must be incorrect because the entire statement is throwing an error.
For example in filew.log if these items don't exist Memsize, SASFoundation and also if... (0 Replies)
Discussion started by: dellanicholson
0 Replies
LEARN ABOUT DEBIAN
x2sys_report
X2SYS_REPORT(1gmt) Generic Mapping Tools X2SYS_REPORT(1gmt)NAME
x2sys_report - Report statistics from crossover data base
SYNOPSIS
x2sys_report -Ccolumn -TTAG [ coedbase.txt ] [ -A ] [ -I[list] ] [ -L[corrtable] ] [ -Nnx_min ] [ -Qe|i ] [ -Rwest/east/south/north[r] ] [
-Strack ] [ -V ]
DESCRIPTION
x2sys_report will read the input crossover ASCII data base coedbase.txt (or stdin) and report on the statistics of crossovers (n, mean,
stdev, rms, weight) for each track. Options are available to let you exclude tracks and limit the output.
-C Specify which data column you want to process. Crossovers related to this column name must be present in the crossover data base.
-T Specify the x2sys TAG which tracks the attributes of this data type.
OPTIONS
No space between the option flag and the associated arguments.
coedbase.txt
The name of the input ASCII crossover error data base as produced by x2sys_cross. If not given we read standard input instead.
-A Eliminate COEs by distributing the COE between the two tracks in proportion to track weight and producing (dist, adjustment) spline
knots files for each track (for the selected column). Such adjustments may be used by x2sys_datalist. The adjustment files are
called track.column.adj and are placed in the $X2SYS_HOME/TAG directory. For background information on how these adjustments are
designed, see Mittal [1984].
-I Name of ASCII file with a list of track names (one per record) that should be excluded from consideration [Default includes all
tracks].
-L Apply optimal corrections to the chosen observable. Append the correction table to use [Default uses the correction table TAG_cor-
rections.txt which is expected to reside in the $X2SYS_HOME/TAG directory]. For the format of this file, see x2sys_solve.
-N Only report data from tracks involved in at least nx_min crossovers [all tracks].
-Q Append e for external crossovers or i for internal crossovers only [Default is external].
-R west, east, south, and north specify the Region of interest, and you may specify them in decimal degrees or in
[+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left and upper right map coordinates are given instead of w/e/s/n. The two
shorthands -Rg and -Rd stand for global domain (0/360 and -180/+180 in longitude respectively, with -90/+90 in latitude). Alterna-
tively, specify the name of an existing grid file and the -R settings (and grid spacing, if applicable) are copied from the grid.
For Cartesian data just give xmin/xmax/ymin/ymax. This option bases the statistics on those COE that fall inside the specified
domain.
-S Name of a single track. If given we restrict output to those crossovers involving this track [Default output is crossovers involv-
ing any track pair].
-V Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].
EXAMPLES
To report statistics of all the external magnetic crossovers associated with the tag MGD77 from the file COE_data.txt, restricted to occupy
a certain region in the south Pacific, try
x2sys_report COE_data.txt -V -TMGD77 -R180/240/-60/-30 -Cmag > mag_report.txt
To report on the faa crossovers globally that involves track 12345678, try
x2sys_report COE_data.txt -V -TMGD77 -Cfaa -S12345678 > faa_report.txt
REFERENCES
Mittal, P. K.(1984), Algorithm for error adjustment of potential field data along a survey network, Geophysics, 49(4), 467-469.
SEE ALSO x2sys_binlist(1)x2sys_cross(1)x2sys_datalist(1)x2sys_get(1)x2sys_init(1)x2sys_list(1)x2sys_put(1)x2sys_solve(1)GMT 4.5.7 15 Jul 2011 X2SYS_REPORT(1gmt)