somedata | awk -F"#soils#" '{split($1,a,"NITNUM="); print a[2]}'
how can i edit the content of array 2 above?
what i want to do is get rid of single quotes and double quotes. and then turn the "NewLine" into new lines.
the data in array 2 (a[2]) is:
"'327685650858'NewLine'4048854814312743'"NewLine1089901687312447NewLine1089901687304767NewLine6669407900051008NewLine3786114055313675
the expected result after the above is modiied should be:
327685650858
4048854814312743
1089901687312447
1089901687304767
6669407900051008
3786114055313675
here's what im currently doing to obtain the desire results:
somedata | awk -F"#soils#" '{split($1,a,"NITNUM="); print a[2]}' | sed -e 's_"__g' -e 's_ __g' -e '/^$/d' 2>/dev/null | awk '{gsub("NewLine","\n");printf"%s",$0}' | sed -e "s/'/ /g" -e 's~ ~~g' | sed '/^$/d'
im hoping to find a portable solution for this. i cant justify running this many commands when i can just do it all with awk.