![]() |
|
|
|
|
|||||||
| 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 06: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 03:50 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Shell script to format a .CSV data
Hi There
I needed to write a Unix shell script which will pick up the data from a .CSV file and reformat it as per the requirement and write it to another .CSV file. Currently I am in the proess of Data Import to "Remedy System" (A one kind of incident mangement Application) and this application accepts the Data in a particular format, Hence I want to accomplish this task with the Script without manual intervension. My Original data loooks some what like this, AcquiredMethod, AssetID, AssetLifecycleStatus, SC1, SC2, DC1, DC2 Vendor Owned, ATESTIMPORT10, Down, a, b, c, d This has to be re-formatted like this AcquiredMethod, AssetID, AssetLifecycleStatus, C, S/D, 1or2 Vendor Owned, ATESTIMPORT10, Down, a, S, 1 Vendor Owned, ATESTIMPORT10, Down, b, S, 2 Vendor Owned, ATESTIMPORT10, Down, c, D, 1 Vendor Owned, ATESTIMPORT10, Down, d, D, 2 I know I am a bad in explaining, however if you go through the excel it will be little clear. The condition is if there is no data in any of the 4 columns (SC1 or SC2 or SC3 or SC4) the same record will not be present in the out CSV file. Can anyone please give the script for the above task. I would really appreciate that. Thanks in Advance, Uday |
| Forum Sponsor | ||
|
|
|
|||
|
Thank you
Hi
Thanks!!. That was very quick and it works 95% correct. Only exception here is it create a record in every instance.., i.e. even if SC1 or SC2 or DC1 or DC2 is blank. I mean we tested this script in all the possibalities, of SC1,SC2,SC3 and SC4, i.e. with all the 16 possibalities and it created total 64 records, where as it should have created only 32. Hence we need to eliminate the other 32 records. Could you advice on this. Once again thank you very much for your swift and accurate reply. Thanks Uday |
| Thread Tools | |
| Display Modes | |
|
|