Hello!
There is a text file, that contains hierarchy of menues, like:
Aaaaa->Bbbbb
Aaaaa->Cccc
Aaaaa-> {spaces} Ddddd (it means that the full path is Aaaaa->Cccc->Ddddd )
Aaaaa-> {more spaces} Eeeee (it means that the full path is Aaaaa->Cccc->Ddddd->Eeeee )
Fffffff->Ggggg
Fffffff-> {spaces} Hhhhh (it means that the full path is Fffffff->Ggggg->Hhhhh)
Fffffff-> {more spaces} Iiiiiiii (it means that the full path is Fffffff->Ggggg->Hhhhh->Iiiiiiii )
I used
$ awk '{if (index ($0, "->")>0){print base $0} else {base = $0}}' j8.txt > j9.txt
to get Aaaaa-> and Ffffff-> in front of lines, but it is only one level.
How I can get full paths in front of every element? I tried to use egrep with regex '.+-+>+[^ ]+' to find Aaaaa->Bbbbb, Aaaaa->Cccc and Fffffff->Ggggg, but I also need to insert them before... And there are 4 levels.... Maybe piping...
Thank you! (I hope everyone can understand what I mean... English is not my native language)