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

👤 Login to reply
 
Thread Tools Search this Thread Display Modes
    #15  
Old 03-14-2017
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 18 July 2018, 4:23 AM EDT
Location: Aachen, Germany
Posts: 13,069
Thanks: 449
Thanked 4,013 Times in 3,690 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 03-14-2017
palex palex is offline
Registered User
 
Join Date: Feb 2011
Last Activity: 4 July 2018, 1:24 PM EDT
Posts: 83
Thanks: 33
Thanked 0 Times in 0 Posts
Yes, the second entry should be suppressed.
Sponsored Links
    #17  
Old 03-14-2017
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 18 July 2018, 4:23 AM EDT
Location: Aachen, Germany
Posts: 13,069
Thanks: 449
Thanked 4,013 Times in 3,690 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 03-14-2017
palex palex is offline
Registered User
 
Join Date: Feb 2011
Last Activity: 4 July 2018, 1:24 PM EDT
Posts: 83
Thanks: 33
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
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 04:58 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?