all this files and thosands more in /test/test2
to get my file I should give some parameter " in this example I give 2 gre some time it will take more than 6 grep's to get what I want " forget it "
--------------------------------------------------
ls -lrt | grep "Apr 10" | grep 1998 | lp
I will get the printe of result not the file it self...Pleassse try to understand me and execuse me for my "GOOD" english
Better to read all what I wrote above or just read this
[ HOW I CAN PRINT THE RESULTED FILES AS A FILE NOT AS OUTPUT ]
ok I will get the result in result.txt as u said then I want to print the files, don't tell me to print result.txt coz I will get in name of the file in the print out and I want to print the information inside the file.It's very simple please don't make me feel my english toooo BAD & unix As well
what I want is the fastest way to print multipul files
Please please read this carefully and try it out before deciding it won't work, because as far as I can tell, it will!
I think that if you can figure out exactly what you are needing to do (which files to print, and when), you could use a very simple find command to do it.
But if you really really really want to use grep a bunch of times, you could do this:
for each in `cat /tmp/lp_file`; do print $each; done
Note: I used backticks ` not single quotes ' above. The backticks are usually near the top left on a standard PC keyboard.
Or like this (if you can narrow what you want down by the filename):
for each in *sep2001.lcq; do; print $each; done
Or what about :
ls -lrt | grep "Apr 10*1998.lqc" | xargs print
Some of these may complain of an error with too many arguments, or possibly that the jobs may not all print, so you may have to use the first/second idea of:
ls -lrt | grep "Apr 10*1998.lcq" > /tmp/lp_list
for each in `cat /tmp/lp_list; do print $each; done
These examples all assume you are using a Bourne shell variant, such as ksh, sh, bash, etc...
Please try these before posting back saying that none of them work. And please let us know why they don't work.
Or even the basic step of taking the file.txt and adding print in the beginning of each line in the file and making it exe.
I know this is horrible scripting, but it works.
I agree that one of Livinfree's suggestions will work. see below his code.
code:
--------------------------------------------------------------------------------
for each in `cat /tmp/lp_file`; do print $each; done
--------------------------------------------------------------------------------