![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cut the last field | 435 Gavea | Shell Programming and Scripting | 9 | 03-17-2009 01:04 PM |
| Retrieve 5th Field to Last Field !! | jobbyjoseph | UNIX for Dummies Questions & Answers | 3 | 05-16-2007 03:20 AM |
| Moving Part of a field to another field using AWK | rjsha1 | Shell Programming and Scripting | 5 | 08-04-2006 05:39 AM |
| add increment field when first field changes | azekry | Shell Programming and Scripting | 2 | 11-14-2005 04:21 PM |
| TTL field??? | solvman | UNIX for Advanced & Expert Users | 11 | 10-12-2001 12:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi all.
I'm trying to teach myself how to use awk from various on-line sources in order to accomplish a specific task. However, I am scratching my head over this: the fields in each record are seperated by commas one field is the date, which is currently like 10/4/2001 I would like it padded with zeros without the slashes, like 10042001 Is there a way to specify a field seperator within a field? that is to say, break down the field into sub-fields? Or am I barking up the completely wrong tree? thanks, kristy |
|
|||||
|
Try the split() function...
The split() function has the syntax: split(<string>,<array>,[<field separator>]) This function takes a string with n fields and stores the fields into array[1], array[2], ... , array[n]. If the optional field separator is not specified, the value of FS (normally space and tab) is used. For example, suppose we have a field of the form: AWK just takes a bit of getting used to but once you do, there is little you can't do with it A great online reference: http://vectorsite.tripod.com/tsawk0.html |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|