![]() |
|
|
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 |
| Extract some common fields from 1 file that are presnt in another file | unxusr123 | UNIX for Dummies Questions & Answers | 1 | 06-11-2008 03:33 AM |
| AWK - printing certain fields when field order changes in data file | eric4 | Shell Programming and Scripting | 3 | 04-15-2008 07:48 PM |
| Sorting Files / Combing Fields / Printing | ccfc1986 | Shell Programming and Scripting | 12 | 12-03-2007 02:38 PM |
| printing select fields in awk | maverix | Shell Programming and Scripting | 5 | 06-22-2007 10:25 AM |
| How to add fields in a file | bjorb | Shell Programming and Scripting | 2 | 10-13-2005 09:11 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
need help with awk in printing the fields in a file
hi all
i get a file from a server and i do not know how many fields that file will contain. i need to cut from the second column of the file to the last, irrespective of how many fields are there. is there any way to make the awk command dynamic for fetching from the second to the last field in the file, some thing similar to cut commmand where giving -f2- will give fields from second to the end.. the reason why i cannot use cut is that a few of the fields have tab as a delimiter and a few have space, as awk treats both as same and fetches the field irrespective of the delimiter being tab or space, i want it to be an awk command... any help. |
|
||||
|
Quote:
Code:
sub(/^[^ \t]+[ \t]+/,"") ^[^ \t]+ -> select one or more non spaces/tabs from the begin of the line [ \t]+ -> select one or more spaces/tabs after the characters of the begin of the line Regards |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|