The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
seeking help in text processing Alecs Shell Programming and Scripting 8 04-22-2008 01:17 PM
text processing ( sed/awk) anchal_khare Shell Programming and Scripting 12 02-29-2008 08:44 AM
Have a shell script check for a file to exist before processing another file heprox Shell Programming and Scripting 3 11-14-2006 03:26 AM
Processing a text file TheCrunge UNIX for Dummies Questions & Answers 1 11-09-2005 11:47 AM
grep multiple text files in folder into 1 text file? coppertone UNIX for Dummies Questions & Answers 7 08-23-2002 02:50 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-09-2007
alias47 alias47 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 7
text file processing

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)
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0