Search Results

Search: Posts Made By: vx04
3,067
Posted By RavinderSingh13
Hello vx04, If I understood your requirement...
Hello vx04,

If I understood your requirement correctly you need to create xml files with name of CustomLetter ids as follows, let me know if you have any queries on same.

awk -vheader1="<?xml...
5,617
Posted By RavinderSingh13
Hello vx04, Could you please try following...
Hello vx04,

Could you please try following and let me know if this helps.

awk '{gsub(/></,">\n<",$0)} 1' Input_file
Output will be as follows.

<?xml version="1.0" encoding="ISO-8859-1"...
1,931
Posted By RudiC
You now can decide which trailer you want, should...
You now can decide which trailer you want, should they be different - the first xml- block's trailer as supplied by Don Cragun's suggestion or the last block's as supplied by mine...
1,931
Posted By Don Cragun
If delete array_name doesn't work in your version...
If delete array_name doesn't work in your version of awk and the trailing part of your xml isn't too large, you can also try the slightly more complex script below. It just uses a variable instead...
2,436
Posted By Scrutinizer
Try: sed -n "/rs:data/,/\\rs:data/{//d;...
Try:

sed -n "/rs:data/,/\\rs:data/{//d; s/[^'=]*=//g; s/''/','/g; s/[^']*$//;p;}" Hospital.xml

or:
awk '$0~s{p=1-p; next} p{print FS $2, $4, $6 FS}' FS=\' OFS="','" s=rs:data Hospital.xml
2,436
Posted By RudiC
This takes care of - no data outside the...
This takes care of
- no data outside the <rs:data> ... </rs:data> region
- several tagged data fields can share the same line
sed -n...
2,436
Posted By Akshay Hegde
Gawk gawk '/^<z/{s=""; while (match($0,...
Gawk

gawk '/^<z/{s=""; while (match($0, /\047([^\047]*)\047(.*)/, x)) { s = sprintf("%s%s\047%s\047",s,(s?OFS:""),x[1] ); $0 = x[2] } print s }' OFS=, infile

---------- Post updated at 09:38...
2,436
Posted By RavinderSingh13
Hello vx04, Following may help you in same....
Hello vx04,

Following may help you in same.

awk -vs1="'" -F"' " '{if($0 ~ /<rs:data>/){B=1;getline}} {if($0 ~ /<\/rs:data>/){B=0}} B{for(i=1;i<=NF;i++){gsub(/.*\=||[/><]/,X,$i);A=A?A...
2,436
Posted By anbu23
$ sed -n...
$ sed -n "/^<z:/s/[^']*\('[^']*'\)[^']*\('[^']*'\)[^']*\('[^']*'\).*/\1,\2,\3/p" file
'John Doe','XYZ Hospital','Heart Health'
'Jane Doe','XYZ Hospital','Maternity'
Showing results 1 to 9 of 9

 
All times are GMT -4. The time now is 01:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy