Unix/Linux Go Back    


UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics.

Xml to csv

UNIX and Linux Applications


Reply    
 
Thread Tools Search this Thread Display Modes
    #15  
Old Unix and Linux 03-14-2017
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 24 May 2017, 4:14 PM EDT
Location: Aachen, Germany
Posts: 10,816
Thanks: 272
Thanked 3,323 Times in 3,060 Posts
That's because your file has two j151 entries in each record, and, as said, each drags along a <newline> char.
Looks like you want to suppress the second entry? Still unclear.
Sponsored Links
    #16  
Old Unix and Linux 03-14-2017
palex palex is offline
Registered User
 
Join Date: Feb 2011
Last Activity: 10 April 2017, 6:43 PM EDT
Posts: 82
Thanks: 32
Thanked 0 Times in 0 Posts
Yes, the second entry should be suppressed.
Sponsored Links
    #17  
Old Unix and Linux 03-14-2017
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 24 May 2017, 4:14 PM EDT
Location: Aachen, Germany
Posts: 10,816
Thanks: 272
Thanked 3,323 Times in 3,060 Posts
Try (unsuppressed):

Code:
awk '/a001|b203|j151/ {L=/a001/; gsub (/ *<[^>]*> */, _); printf "%s%s", L?TRS:"\t", $0; TRS=ORS} END {printf RS}' file
9781328740472    Peepers    7.99    10.99

    #18  
Old Unix and Linux 03-14-2017
palex palex is offline
Registered User
 
Join Date: Feb 2011
Last Activity: 10 April 2017, 6:43 PM EDT
Posts: 82
Thanks: 32
Thanked 0 Times in 0 Posts
Great, I know how to remove the fourth column from there. Thanks so much for your help!
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 01:10 AM.