![]() |
|
|
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 |
| using sed to get rid of duplicated columns... | fedora | Shell Programming and Scripting | 5 | 11-28-2008 10:45 AM |
| Row to Columns | vskr72 | UNIX for Dummies Questions & Answers | 4 | 03-21-2007 09:53 AM |
| extracting from tar.bz2 | Raom | UNIX for Advanced & Expert Users | 1 | 03-07-2006 10:33 AM |
| Extracting columns from different files for later merging | kingkong | UNIX for Dummies Questions & Answers | 2 | 11-23-2005 03:21 AM |
| add columns with awk | tonet | Shell Programming and Scripting | 4 | 06-21-2005 04:02 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Need help in extracting columns
Hi ,
I have a file having around 8 columns spereated by space . Now that I need to extract columns from this. The problem is this functionality is needed in a script and the required columns are dynamic and can range from 2 columns to 8 columns at a time . What I tried without luck is If I could get the required column numbers in a variable in the below format var_col="1\" \"\$2\" \"\$3" awk -v awkvar=$var_col '{print $awkvar}' here I expected to print the 1st,2nd and 3rd cols seprated by a space.But this did not work. Can somebody help me out here please ? |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|