The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script to search for text in a file and copy file imeadows UNIX for Dummies Questions & Answers 9 11-12-2008 09:12 PM
Shell script for text extraction from a file vignesh53 Shell Programming and Scripting 3 02-05-2008 08:16 AM
Looking for command(s)/ script to find a text string within a file wrwelden Shell Programming and Scripting 5 11-23-2006 12:53 AM
Using the Finger command in a Script apolishuk Shell Programming and Scripting 4 12-02-2003 02:42 PM
redirecting username to finger dhinojosa UNIX for Dummies Questions & Answers 2 02-06-2002 12:11 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-07-2005
Micz Micz is offline
Registered User
  
 

Join Date: Jul 2003
Posts: 12
How to input username on text file into finger command on shell script

I'm trying to clean up my server and I have the list of some "special" users stored on the text file like this

Quote:
abcd
defg
kndad
daodi
Now I want to write a shell script to finger all of them so I can have some kind of ideas who they are but here comes the problem....I completely forgot how to do it with shell script (it has been such a long time since I wrote one anyway). Please do not tell me to do it manually since it has about 300 username on the list (gonna take forever to do it )

So I reallie appreicate if anyone here can give me some kind of advice on how to do it. I'm having problem trying to figure out how to take the username on the text file and input them into the finger command (maybe using while but hmm...)
  #2 (permalink)  
Old 11-07-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Code:
#! /bin/sh
while read username; do
  finger ${username}
done < inputfile > outputfile
exit 0
Cheers
ZB
  #3 (permalink)  
Old 11-08-2005
Micz Micz is offline
Registered User
  
 

Join Date: Jul 2003
Posts: 12
omg, this is definitely what i'm looking for....thx you so much. Here my last question (i promise I won't bothering u anymore )

When you do the "du" command, it will usualy display the result in the format like this

10MB /home/test/username

so is there anyway that I can cut the "username" from it so that I can input it into the my current finger script? I guess sed or awk would do but gosh, where is my sed & awk book

Last edited by Micz; 11-08-2005 at 01:07 AM..
  #4 (permalink)  
Old 11-08-2005
Abhishek Ghose Abhishek Ghose is offline
Registered User
  
 

Join Date: Sep 2005
Location: Chennai
Posts: 81
echo "10MB /home/test/username"|awk -F"/" '{print $NF}'
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:28 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0