Print Multipul Fiels as One shot


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Print Multipul Fiels as One shot
# 1  
Old 04-10-2002
Question Print Multipul Fiels as One shot

Hi there

This is my first post. I just want to know the best way to print N number of files as one shot. Let's simulate the case ...


> ls

file1.txt
file2.txt
file3.txt
file4.txt
file5.txt

What is the best way to print all this files.. what I'm doing now is

/ > print file1.txt ; print file2.txt ; print file3.txt ; print file4.txt

is there's faster way to do that...... thaanks
# 2  
Old 04-10-2002
Hi,

try this

find /yourDirectory -name "*.txt" -exec print {} \;


the {} is for all files found by the find command

for more information try

man find Smilie


RGDS

Frank
# 3  
Old 04-10-2002
Thanks But......

Thanks but....

actually u didn't get what I ment, ,I just give an example *.txt files,, actually I have dirctory contain 100000 (OR MORE) files (some old reports and logs ). When I want to get the files I just grep it " ls -lrt | grep "date" | grep "another Parameter" then I will get the result. Now I want to know whatis the best way to print all the files with out manually give print command for each file. I hope u get what I mean
# 4  
Old 04-10-2002
If you need to list only top 10 files in an directory, then -

ls -l | head -11

you can also use - "ls -lt | head -11" for viewing 10 recently modified files.

Hope this is useful.
# 5  
Old 04-10-2002
Well, first, I don't see why you need "ls -lrt". Do they need to print in date order?

But I still agree with isacs:
Code:
find /your/dir -type f -name "*date*[0-9][0-9]*" -exec lp -dmy_printer {} \;

That will find only files (not directories) in /your/dir that have the word "date" before some numbers, then send each one to the line printer in the order in which it finds them.

Look at the name page for find for all finds of options, including ones to keep the search in the /your/dir directory, instead of trying to keep searching below it.
# 6  
Old 04-10-2002
Tools I'm Confuse!!!!!!!

guys forget the find command coz with find command u can't get condational output like grep. I will give small example :-


Apr 10 09:12 aacbl222_12aug1998.lqc
Apr 10 09:12 sscbl4534_4sep2001.lqc
Apr 10 09:12 ah66fmi_5jan1997.lqc
Apr 10 09:12 y313h1_7sep1998.lqc
May 11 09:12 aalike_9aug2000.lqc

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

Apr 10 09:12 y313h1_7sep1998.lqc
Apr 10 09:12 aacbl222_12aug1998.lqc

--------------------------------------------------

now when I want to print what I got from my command I will do this : -

print y313h1_7sep1998.lqc ; print aacbl222_12aug1998.lqc

when I type

ls -lrt | grep "Apr 10" | grep 1998 | lp -printername
I will get the printes result not the file it self...Pleassse try to understand me and execuse me for my "GOOD" english Smilie

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 ]Smilie Smilie
# 7  
Old 04-10-2002
Use backtilt

lp printername `ls -ltr|grep "your_param"|grep "your_param2"`

or

lp printername `ls -ltr | grep "your_param1.*your_param2"` - If you are using the param as per your example.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find/searching files in subdirectories excluding the fiels in Parent Directory

Hi All, requirement is to find and remove the files from sub directories but it should exclude the files from parent directory. At present i am using the below one but it finds and remove files from both parent and sub directories. find ${PATH} -type f \( -name securitas\* -o -name \*gz... (1 Reply)
Discussion started by: Naveenkk
1 Replies

2. Shell Programming and Scripting

Convert Text within multipul files - for loop

Is this possible? #!/bin/ksh for file in `*.idlesince` do while read inter time do printf "%s %s\n" "${inter}" "$(perl -e 'print scalar localtime('"${time}"') . "\n";')" >> "${file}.done" done < "${file}" done The error I get is line 9: router.idlesince: command not... (1 Reply)
Discussion started by: mrlayance
1 Replies

3. Shell Programming and Scripting

To change the ownership at one shot

i have a directory in which i have Multiple files: Following are they==== -rw-r--r-- 1 root root 886 Jan 21 16:38 trunkn.xsd -rw-r--r-- 1 root root 244 Jan 21 16:38 trunknameCache.xml -rw-r--r-- 1 root root 1240 Jan 21 16:38 subscribercache.xsd -rw-r--r-- 1 root ... (1 Reply)
Discussion started by: Aditya.Gurgaon
1 Replies

4. Shell Programming and Scripting

remove a 350 files in one shot

i have a dir called logs. In it i have some 350 files how to move all those files from directory logs to a new dir called archive I want to do it in single shot Below the command i m trying but not getting find . -name "CurrentCollector*" -exec mv {} archive \;... (2 Replies)
Discussion started by: ali560045
2 Replies

5. Shell Programming and Scripting

My first shot at variables

Okay, so im setting up a script to start my internet dependent scripts once I am connected to the net. It got complicated because of the different networks I frequent but it goes something like this: n=1 iwconfig wlan0 > wireless.txt m= grep -c MGHS /home/jake/Scripts/wireless.txt o= grep -c... (7 Replies)
Discussion started by: arcnsparc
7 Replies

6. AIX

script which take a snap shot of Topas

can any one give me a script which take a snap shot of Topas at a fix interval of 15min and save it in a perticular file!!!!!!!! (6 Replies)
Discussion started by: abhishek27
6 Replies

7. Shell Programming and Scripting

Delete all occurence of a word in one shot

i have a file called file1 cat file1 i am namish namish lives in India India and namish both are good. I want to delete all the occurences of namish in one shot,if i do it with sed i guess all the lines will be deleted containing the pattern.Suggest me any idea without AWK. Thanks... (6 Replies)
Discussion started by: namishtiwari
6 Replies

8. Shell Programming and Scripting

How to FTP fiels according to generated date

Hi, I need to get some files from a server via ftp. normaly I use following scrip, it is worrking fine. cd dir_name ftp -v -n "10.76.170.17" << cmd user "rbi" "rbi" cd recordreceive prompt... (0 Replies)
Discussion started by: maheshsri
0 Replies

9. UNIX for Dummies Questions & Answers

unix screen shot

i would like to see an unix screen shot if anyone could take a screen shot of unix (7 Replies)
Discussion started by: royal
7 Replies
Login or Register to Ask a Question