![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting remote data through shell script | armohans | Shell Programming and Scripting | 1 | 04-15-2008 05:07 PM |
| Help writing shell script in c++ format | deadleg | Shell Programming and Scripting | 2 | 03-07-2008 07:08 AM |
| extract data from xml- shell script using awk | nishana | Shell Programming and Scripting | 5 | 07-16-2007 06:20 AM |
| format csv file using shell script | raosurya | UNIX for Advanced & Expert Users | 3 | 06-27-2007 05:57 AM |
| Pipe data to shell script | tomjones07 | Shell Programming and Scripting | 3 | 03-14-2007 04:50 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
||||
|
||||
|
From your input/output, you simply don't want to print lines where any of SC1, SC2, SC3, SC4 is empty - thats simple enough that you could have done it yourself:
Code:
#!/usr/bin/ksh
nawk -F"," 'BEGIN{OFS=","}{ if (NR==1) {
print "AcquiredMethod, AssetID, AssetLifecycleStatus, C, S/D, 1or2"
} else {
if ($4 != "")
print $1,$2,$3,$4,"S",1
if ($5 != "")
print $1,$2,$3,$5,"S",2
if ($6 != "")
print $1,$2,$3,$6,"D",1
if ($7 != "")
print $1,$2,$3,$7,"D",2
}}' input.csv
HTH |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
Thanks!
Thank you for your reply, and sorry to bother you so much!..
Thank you for you advice. Uday |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|