Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


Closed Thread
  Search this Thread
Old 07-23-2009, 12:05 AM   #1
Registered: Dec 2008
Location: New York
Distribution: RedHat, Solaris
Posts: 68

Rep: Reputation: 16
Help with awk or sed.

Hi, I am stuck on the following issue with awk and need help. I currently have data that looks like this:

Directory of /home/admin/slap/test

06/09/2009 08:15 AM 954,880 bin.fla
02/09/2009 09:48 AM 173,905 bin.swf
03/23/2009 11:04 AM 2,168 bin.xml
06/09/2009 08:15 AM 830,464 dnd.fla
02/05/2009 12:47 PM 175,001 dnd.swf
02/05/2009 11:13 AM 1,835 dnd.xml
06/09/2009 08:15 AM 755,712 mcq.fla
06/09/2009 08:15 AM 46,843 mcq.swf
06/09/2009 08:15 AM 2,706 mcq.xml

Directory of /home/admin/slap/test2

06/09/2009 08:16 AM 954,880 bin.fla2
02/09/2009 09:47 AM 173,905 bin.swf2
03/23/2009 11:04 AM 2,168 bin.xml2
06/09/2009 08:17 AM 830,464 dnd.fla2
02/05/2009 12:48 PM 175,001 dnd.swf2
02/05/2009 11:10 AM 1,835 dnd.xml2
06/09/2009 08:16 AM 755,712 mcq.fla2
06/09/2009 08:14 AM 46,843 mcq.swf2
06/09/2009 08:12 AM 2,706 mcq.xml2

I need to somehow run through this file and extract out "Directory of /home/admin/slap/test" and append it to each file in the 5th field.

So the end result would be something like:

Directory of /home/admin/slap/test/bin.fla
Directory of /home/admin/slap/test/bin.swf
Directory of /home/admin/slap/test/bin.xml

for each block of text. So the next block would be

Directory of /home/admin/slap/test2/bin.fla2
Directory of /home/admin/slap/test2/bin.swf2
Directory of /home/admin/slap/test2/bin.xml2

Not sure if awk would be the right tool or if this is even possible. Any advice would be great. This was a originally a directory list of all files and we need to somehow reconstruct back to a full directory listing.

Old 07-23-2009, 03:45 AM   #2
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
I replied to your other post, here. Please don't double post. I reported this one for closure.

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
sed or awk ilo Programming 1 08-22-2008 11:38 AM
SED/AWK help bioinformatics_guy Linux - Newbie 1 08-12-2008 06:07 AM
awk and/or sed linux2man Linux - General 7 01-22-2007 11:02 AM
Sed and Awk Gins Programming 7 04-19-2006 11:32 AM
awk/sed help pantera Programming 1 05-14-2004 12:59 AM

All times are GMT -5. The time now is 04:38 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration