This is a combo useless use of cat and useless use of backticks. Loading an entire file into a variable to chop it like this is especially dangerous since, if the file is larger than the maximum size of a shell variable, the end will get chopped off.
You shouldn't feed variables into printf's command string unless you can control exactly what they are. It will throw up on or mangle anything with % or \ in it.
It ignores every fifteenth cell.
It may end up printing the last line without an ending line-feed, which may prevent the last line from being read by various UNIX utilities like sed and awk.
It would require a KSH or KSH-like shell, for the $(( )) math syntax.
Last edited by Corona688; 06-16-2011 at 01:50 PM..
Hi Friends,
I have a log file as below
siteid = HYD
spc = 100
rset = RS_D_M
siteid = DEL
spc = 200
rset = RS_K_L
siteid = DEL2
spc = 210
rset = RS_D_M
Now I need a output like column wise as below.
siteid SPC rset
HYD 100 RS_D_M (2 Replies)
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)
This is for an Oracle journal import. I was using a pl/sql package and oracle API's. Oracle added invoker rights to their API's and now my package won't run. I didn't want to use their API's anyway. The only reason i was using pl/sql and the API's (just a package) was to utilize a cursor. How... (2 Replies)
Hi Everyone,
I have a file text.cvs, which is a file with columns from excel. The data are separeted with semicolon. The content of the file looks like
A B C D E F
1 3 3 4 3 3
2 2 1 2 5 2
5 6 1 1 2 1
Now I wish to write an script which writes the colums A, C and F in... (4 Replies)
I have a script which converts rows to columns.
file_name=$1
mailid=$2
#CREATE BACKUP OF ORIGINAL FILE
#cp ${file_name}.xlsx ${file_name}_temp.xlsx
#tr '\t' '|' < ${file_name}_temp.xlsx > ${file_name}_temp.csv
#rm ${file_name}_temp.xlsx
pivot_row=`head -1 ${file_name}`
sed 1d... (3 Replies)
Hi All
I want to have a Perl script which convert columns to rows.
The Perl should should read the data from input file.
Suppose the input file is
7215484
date to date
173.3
A
1.50
2.23
8.45
10.14
2.00
4.50
2.50
31.32
7216154
month to month (3 Replies)
I have a dataset with 120 columns. I would like to write a script, that takes the average of every two columns, starting from columns 2 and 3, and moving consecutively in frames of 3 columns, all the way until the last column.
The first column in the output file would be the averages of columns... (1 Reply)
Hi
I have a file having the values like below
----------------------------
.set A
col1=”ABC”
col2=34
col3=”DEF”
col4=”LMN”
col5=25
.set A
.set B
col1=55
col3=”XYZ”
col4=”PQR”
col5=66
.set B
.set C
col2=”NNN” (1 Reply)
Hello, everyone
I am beginner for shell programming. I want to print all lines that have the same values in first two columns
data:
a b 1 2
a a 3 4
b b 5 6
a b 4 6
what I expected is :
a a 3 4
b b 5 6
but I searched for one hour in... (2 Replies)
Hello
I have a large database with the following structure:
Headword=Gloss1;Gloss2;Gloss3
The Glosses are separated by a ;
What I need is to reduce the multiple glosses on each row to columns
Headword=Gloss1
Headword=Gloss2
Headword=Gloss3
I had written the following script in awk... (5 Replies)
Discussion started by: gimley
5 Replies
LEARN ABOUT MOJAVE
mpsmatrixdescriptor
MPSMatrixDescriptor(3) MetalPerformanceShaders.framework MPSMatrixDescriptor(3)NAME
MPSMatrixDescriptor
SYNOPSIS
#import <MPSMatrixTypes.h>
Inherits NSObject.
Class Methods
(__nonnull instancetype) + matrixDescriptorWithDimensions:columns:rowBytes:dataType:
(__nonnull instancetype) + matrixDescriptorWithRows:columns:rowBytes:dataType:
(__nonnull instancetype) + matrixDescriptorWithRows:columns:matrices:rowBytes:matrixBytes:dataType:
(size_t) + rowBytesFromColumns:dataType:
(size_t) + rowBytesForColumns:dataType:
Properties
NSUInteger rows
NSUInteger columns
NSUInteger matrices
MPSDataType dataType
NSUInteger rowBytes
NSUInteger matrixBytes
Detailed Description
This depends on Metal.framework
A MPSMatrixDescriptor describes the sizes, strides, and data type of a an array of 2-dimensional matrices. All storage is assumed to be in
'matrix-major'. See the description for MPSMatrix for further details.
Method Documentation
+ (__nonnull instancetype) matrixDescriptorWithDimensions: (NSUInteger) rows(NSUInteger) columns(NSUInteger) rowBytes(MPSDataType) dataType
Create a MPSMatrixDescriptor with the specified dimensions and data type.
Parameters:
rows The number of rows of the matrix.
columns The number of columns of the matrix.
rowBytes The number of bytes between starting elements of consecutive rows. Must be a multiple of the element size.
dataType The type of the data to be stored in the matrix.
For performance considerations the optimal row stride may not necessarily be equal to the number of columns in the matrix. The MPSMatrix
class provides a method which may be used to determine this value, see the rowBytesForColumns API in the MPSMatrix class. The number of
matrices described is initialized to 1.
+ (__nonnull instancetype) matrixDescriptorWithRows: (NSUInteger) rows(NSUInteger) columns(NSUInteger) matrices(NSUInteger)
rowBytes(NSUInteger) matrixBytes(MPSDataType) dataType
Create a MPSMatrixDescriptor with the specified dimensions and data type.
Parameters:
rows The number of rows of a single matrix.
columns The number of columns of a single matrix.
matrices The number of matrices in the MPSMatrix object.
rowBytes The number of bytes between starting elements of consecutive rows. Must be a multiple of the element size.
matrixBytes The number of bytes between starting elements of consecutive matrices. Must be a multiple of rowBytes.
dataType The type of the data to be stored in the matrix.
For performance considerations the optimal row stride may not necessarily be equal to the number of columns in the matrix. The MPSMatrix
class provides a method which may be used to determine this value, see the rowBytesForColumns API in the MPSMatrix class.
+ (__nonnull instancetype) matrixDescriptorWithRows: (NSUInteger) rows(NSUInteger) columns(NSUInteger) rowBytes(MPSDataType) dataType
+ (size_t) rowBytesForColumns: (NSUInteger) columns(MPSDataType) dataType
+ (size_t) rowBytesFromColumns: (NSUInteger) columns(MPSDataType) dataType
Return the recommended row stride, in bytes, for a given number of columns.
Parameters:
columns The number of columns in the matrix for which the recommended row stride, in bytes, is to be determined.
dataType The type of matrix data values.
To achieve best performance the optimal stride between rows of a matrix is not necessarily equivalent to the number of columns. This method
returns the row stride, in bytes, which gives best performance for a given number of columns. Using this row stride to construct your array
is recommended, but not required (provided that the stride used is still large enough to allocate a full row of data).
Property Documentation
- columns [read], [write], [nonatomic], [assign]
The number of columns in a matrix.
- dataType [read], [write], [nonatomic], [assign]
The type of the data which makes up the values of the matrix.
- matrices [read], [nonatomic], [assign]
The number of matrices.
- matrixBytes [read], [nonatomic], [assign]
The stride, in bytes, between corresponding elements of consecutive matrices. Must be a multiple of rowBytes.
- rowBytes [read], [write], [nonatomic], [assign]
The stride, in bytes, between corresponding elements of consecutive rows. Must be a multiple of the element size.
- rows [read], [write], [nonatomic], [assign]
The number of rows in a matrix.
Author
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.
Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSMatrixDescriptor(3)