I have a file, I need to concatenate depening on the no of columns i need to concatenate.
for example i need to concatenate field1,filed34,field2( no of columns is not always 3, it can be any number of fields)
concat.ksh field1 field34 field2
how to achieve this, is there any argv ,argc equivalent in ksh.
You shoud look at the $# and $1, $2,... constructs for ksh. In short $# gives you the number of command line parameters, and $1, $2 gives the parameter1, parameter2. Read man ksh for more details.
if
1) i have a variable say var=1,9,2 .....etc (
2) I have a file with 10 fields file.dat
3) I need to concatenate $1$9$2 ... from file.dat(I can have more than 3 fields to concatenate.)
I know how can i do if i have constant fields but no of fields to concatenate varies for each file and i need to write a common script to take of this.
Please any suggestions or solution is appreciated.