![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| concat strings | melanie_pfefer | Shell Programming and Scripting | 1 | 12-04-2007 07:12 AM |
| simple question on string concat | the_learner | High Level Programming | 2 | 08-23-2007 11:09 PM |
| concat string | mpang_ | Shell Programming and Scripting | 1 | 07-25-2006 06:03 AM |
| Concat | dhananjaysk | Shell Programming and Scripting | 1 | 03-20-2006 07:42 AM |
| Concat date | drukkie | UNIX for Dummies Questions & Answers | 2 | 05-30-2002 07:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
concat fields
hi
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. Hope i am clear Mark. |
|
||||
|
sorry , i didn't phrase the question correctly.
actually i have those particular fields that needs to be concatenated in a variable. like this var1 = 1 24 3 so i need to concatenate these fields, please let me know. Thanks Mark. |
|
||||
|
start with awk
Code:
#!/bin/ksh
# $1 $2 $3 equal a field number eg, 1 7 32
echo "$myvariable" | awk -v one=$1 -v two=$2 -v three=$3 '{ print $one $two $three }' | read new_variable
# new_variable has the three fields concatenated
|
|
||||
|
Jim, this works if we know how many fields we are concatenating.,
in my case, i have n number of fields in the variable that needs to be concatenated. How can i achieve this. Thanks all for your help. Last edited by markjason; 10-23-2006 at 11:44 AM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|