![]() |
|
|
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 |
| string manipulating | psalas | UNIX for Dummies Questions & Answers | 9 | 04-15-2008 11:00 AM |
| Manipulating File | rivendell500 | SUN Solaris | 2 | 03-25-2008 10:52 PM |
| manipulating csv to add extra row | neil546 | Shell Programming and Scripting | 3 | 07-16-2007 08:11 AM |
| Manipulating two files | rinku11 | UNIX for Advanced & Expert Users | 4 | 12-11-2006 03:47 AM |
| date manipulating | tamer | UNIX for Dummies Questions & Answers | 3 | 01-08-2001 09:46 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Manipulating awk $variables using sed?
I have been searching around the forums here trying to find a solution to my problem but not getting anywhere but closer to baldness.
I have a 20 column pipe "|" seperated text file. The 14th variable doesnt always exist, but will have the format of YYYYMM or YYYY if it does. I need to take the 14th variable, and modify it to a YYYY-MM-DD format. 10000056|13615619|Something||||3533545|Something|Else|||||200405|78791|Disc|MUS000000|||| So, that 200405 needs to look like 2004-05-00, or 2004-00-00 if no month, 0000-00-00 if no value for $14 is available. Any advice? Is it possible to apply that kind of variable sed to an awk variable? awk -F\| '{print $1-$13 `echo $14|sedfoo` $15-$20}' is what I was dreaming of.. Last edited by r0sc0; 04-04-2006 at 05:44 PM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|