LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-19-2012, 01:19 AM   #1
ajayan
Member
 
Registered: Dec 2007
Posts: 89

Rep: Reputation: 16
using awk in fuser output


Hello,

I am trying to list users who are accessing directory using
fuser and awk.

Output of fuser /test is

testserver:/tmp # fuser /net/test
/net/test: 10428c 10488c

I am looking to get each process in a for loop, but for this none of my awk syntax help me...

fuser /net/test | awk '{$1=" "; print $0}' is showing only one process id instead of all.

/net/test: cc
10488


Can some help on this..
Thanks
Ajayan
 
Old 10-19-2012, 01:56 AM   #2
kabamaru
Member
 
Registered: Dec 2011
Location: Greece
Distribution: Slackware
Posts: 276

Rep: Reputation: 134Reputation: 134
Code:
fuser /net/test 2>/dev/null | awk '{ for (i=1; i<=NF; i++) print $i }'

Last edited by kabamaru; 10-19-2012 at 02:14 AM.
 
  


Reply



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
[SOLVED] Pass search results to awk, and use awk output to search other files bspears1 Linux - Newbie 8 07-21-2012 09:17 AM
[SOLVED] Bash; awk or sed output to variable: how keep newline at end of each output line porphyry5 Programming 3 06-10-2011 05:50 PM
how to save output of 'fuser' to a file p_raju AIX 5 05-31-2008 04:18 AM
how to save output of 'fuser' to a file p_raju Linux - General 2 05-28-2008 10:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:10 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