![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Linux Support Linux - Operating Systems and Applications Support |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Oct 2009
Location: Sayre, Williamsport, Philadelphia
Posts: 13
OS: Win XP sp2, Vista Business, Ubuntu, Server 2k3, Server 2k, Kazeon
|
I am using the BASH command 'find' for to list each file in the directory and sub directories. I would like to send each of these files to formail to be converted to .mbox. However, My output is only all the file paths instead of a seperate converted file for each. Here is the BASH line I am using.
find | cat | while read line; do /usr/bin/formail > mail/FindMbox/$file.mbox; done It creats a file name 20.mbox (i assume my $file syntax is incorrect) which contains only the output of the find command. Any idea on how I can get /usr/bin/formail to look at each line and convert the seperate files? |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#3 (permalink) |
|
Registered User
Join Date: Oct 2009
Location: Sayre, Williamsport, Philadelphia
Posts: 13
OS: Win XP sp2, Vista Business, Ubuntu, Server 2k3, Server 2k, Kazeon
|
Re: piping
I tried using awk... but it didn't really make a difference. I wrote a script to do an ls -1 on each folder and then pipe the lines to formail. But, that still doesnt work. It just gives me a single file output and doesnt actually convert the data.
When i run formail for just one messages, i still cant extract the data. So, it doesnt really make a difference if i can loop them or not. |
|
|
|
|
|
#4 (permalink) |
|
Registered User
Join Date: Jan 2007
Location: Wuhan, China
Posts: 53
OS: XP, Ubuntu
|
Re: piping
Sorry, I don't have formail installed on my system, so I can't try it myself. However, I'd try to cut down the problem in pieces to find out where the problem is.
To do this, I'd first redirect the output of the find command into a file list, like ls -1R | grep -iv "./" >filelist.file (note that it is ls minus one big R, not minus small L) Look at the created file to see if the output really is what you'd like to pipe ontu your formail command. In a second step, let's see if the formail command works on your input. head 1 filelist.file | formail In a third step, do something like for i in {1..`wc -l filelist.file`} do head $i filelist.file done and in a last step for i in {1..`wc -l filelist.file`} do head $i filelist.file | formail done This way you'll find out which step in your command pipe is broken, and you can correct it step by step. Note that "do something like" means that my syntax is incorrect. From your first post I guess that your "find" is shorthand for something much longer like find my_directory -n mynames* -exec .... The output of your find command will be a list of files. You pipe it onto a cat. cat will show you the content of one file (as opposed to a list of files). There might be more than one problem in your command chain, so I think it's best to tackle them step by step. Good luck! |
|
|
|
|
|
#5 (permalink) |
|
Registered User
Join Date: Oct 2009
Location: Sayre, Williamsport, Philadelphia
Posts: 13
OS: Win XP sp2, Vista Business, Ubuntu, Server 2k3, Server 2k, Kazeon
|
thanks, I will try this now.
wrote a different script that works, but is similar to your advice.. thanks! Last edited by wmorri; 11-10-2009 at 07:35 PM. Reason: merge |
|
|
|
![]() |
| Thread Tools | |
|
|