LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices

Reply
 
Search this Thread
Old 05-27-2008, 09:10 AM   #1
p_raju
LQ Newbie
 
Registered: May 2008
Posts: 11

Rep: Reputation: 0
Question how to save output of 'fuser' to a file


Hi,

I am trying to create a shell script for checking whether a file is being used by any process. If file is not being used by any process and I want to compress or gzip that file. I want to do this for compressing mount space.
The problem I am facing is, when I do

find . -name "*req" -size +10000 -exec fuser {} \; >> spoolfile.txt

The output of fuser is not saving the spoolfile. Instead its displaying on Standard Output

Can anybody help on this.


Thanks,
Raj
 
Old 05-27-2008, 09:41 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

The redirection part (>> spoolfile.txt) is placed wrong. It should be:

find . -name "*req" -size +10000 -exec fuser {} >> spoolfile.txt \;

The redirection is part of the fuser statement, not find.

Hope this helps.
 
Old 05-27-2008, 11:40 AM   #3
p_raju
LQ Newbie
 
Registered: May 2008
Posts: 11

Original Poster
Rep: Reputation: 0
Question

Quote:
Originally Posted by druuna View Post
Hi,

The redirection part (>> spoolfile.txt) is placed wrong. It should be:

find . -name "*req" -size +10000 -exec fuser {} >> spoolfile.txt \;

The redirection is part of the fuser statement, not find.

Hope this helps.

#########

Hi druuna,

Thanks for your reply.
but still the same issue. The output is not saved in the spool file. I used command like given below.


find . -name "*req" -size +10000 -exec fuser {} >> spoolfile.txt \;


Pls help.

Thanks,
Raju. Payannavar
 
Old 05-28-2008, 03:55 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
Try that:
Code:
find . -name "*req" -size +10000 -exec fuser {} + >> spoolfile.txt 2>&1
 
Old 05-28-2008, 04:55 AM   #5
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
I didn't aware you double posted! Look at your duplicate thread for the answer (before it's closed) and consider jlliagre suggestion.
 
Old 05-31-2008, 05:18 AM   #6
p_raju
LQ Newbie
 
Registered: May 2008
Posts: 11

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by jlliagre View Post
Try that:
Code:
find . -name "*req" -size +10000 -exec fuser {} + >> spoolfile.txt 2>&1
++++++++++++++++++

Thanks a Million. It working as I expected.


Regards,
Raju Payannavar
 
  


Reply

Tags
file, fuser, output


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
how to save output from a command to a variable? tomolesonjr Linux - Newbie 6 04-19-2006 04:04 PM
save java output to kshell var zhebincong Programming 5 12-20-2005 10:29 AM
Screen Listing Output Save in a File rolly frando Linux - Newbie 3 07-04-2005 02:23 AM
How do I save the output from a program? Fe98 Programming 4 11-10-2003 10:18 AM
PHP: save output to a file mikeshn Programming 2 10-25-2003 07:57 AM


All times are GMT -5. The time now is 11:52 AM.

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