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


Closed    
 
Thread Tools Search this Thread Display Modes
    #15  
Old Unix and Linux 03-14-2017   -   Original Discussion by palex
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 23 November 2017, 2:48 PM EST
Location: Aachen, Germany
Posts: 11,652
Thanks: 323
Thanked 3,620 Times in 3,325 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   -   Original Discussion by palex
palex palex is offline
Registered User
 
Join Date: Feb 2011
Last Activity: 24 October 2017, 3:22 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   -   Original Discussion by palex
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 23 November 2017, 2:48 PM EST
Location: Aachen, Germany
Posts: 11,652
Thanks: 323
Thanked 3,620 Times in 3,325 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   -   Original Discussion by palex
palex palex is offline
Registered User
 
Join Date: Feb 2011
Last Activity: 24 October 2017, 3:22 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
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 11:49 PM.