P
P
pavel0staratel2014-06-12 19:18:25
Text Processing Automation
pavel0staratel, 2014-06-12 19:18:25

Is there a generic approach for converting text?

Is there any convenient tool in which you can set the transformation of text from one view to another?
For example:
Source text:
a b1 c1 a b2 c2 a b3 c3 Result: My_text1 a
My_text2 b1, b2, b3 My_text3 c1, c2, c3 Type xslt only for plain text. Maybe with the ability to graphically create a transformation template - such as pointing with the mouse what should correspond to what.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
yttrium, 2014-06-12
@yttrium

there is an awesome text editor sed
in collaboration with awk, you can do magic
purely for the sake of an example, suppose that you can place each cell separately on a line

$ echo 'a b1 c1 a b2 c2 a b3 c3' | sed -e 's/\s/\n/g'
a
b1
c1
a
b2
c2
a
b3
c3

after which we collect data about the cells and display the result
echo 'a b1 c1 a b2 c2 a b3 c3' | sed -e 's/\s/\n/g' | awk '/a/ {a[$0]}; /b/ {b[$0]}; /c/ {c[$0]}; END {for (i in a){m[0] = m[0] " " i};for (i in b){m[1] = m[1] " " i};for (i in c){m[2] = m[2] " " i}; for (i in m){print "Мой текст" m[i]}}'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question