LinuxQuestions.org
Review your favorite Linux distribution.
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, 02: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, 02:56 AM   #2
kabamaru
Member
 
Registered: Dec 2011
Location: Greece
Distribution: Slackware
Posts: 276

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

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


Reply


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
[SOLVED] Pass search results to awk, and use awk output to search other files bspears1 Linux - Newbie 8 07-21-2012 10: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 06:50 PM
how to save output of 'fuser' to a file p_raju AIX 5 05-31-2008 05:18 AM
how to save output of 'fuser' to a file p_raju Linux - General 2 05-28-2008 11:50 AM

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

All times are GMT -5. The time now is 10:16 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration