LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 08: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, 08:41 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 10: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, 02:55 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

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

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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, 04: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



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

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 05:19 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
Open Source Consulting | Domain Registration