How to input username on text file into finger command on shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to input username on text file into finger command on shell script
# 1  
Old 11-07-2005
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 Smilie (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 Smilie)

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  
Old 11-07-2005
Code:
#! /bin/sh
while read username; do
  finger ${username}
done < inputfile > outputfile
exit 0

Cheers
ZB
# 3  
Old 11-08-2005
Smilie 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 Smilie)

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 Smilie

Last edited by Micz; 11-08-2005 at 01:07 AM..
# 4  
Old 11-08-2005
echo "10MB /home/test/username"|awk -F"/" '{print $NF}'
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need list of input and output parameter of task in a text file, using shell script

//file begin ===== //some code task abcd_; input x; input y,z; //some comment output w; //some comment reg p; integer q; begin //some code end endtask : abcd_ //some code //file end ===== expected output from above... (1 Reply)
Discussion started by: rishifrnds
1 Replies

2. UNIX for Dummies Questions & Answers

Inserting shell script input data automatically from a text file

Dear experts, I am new to linux programming. I have a shell script which i should run it on all my samples. I only define input and out put for this script. The inputs are 3 numbers(coordination numbers) which are available in a series of text file. Since i have a lots of samples, it takes a... (5 Replies)
Discussion started by: mohamadreza
5 Replies

3. Shell Programming and Scripting

Shell script to input as if from command line to the java program

Hi, We are having a java server which can run on command line and once initiated, it will prompt options to enter from 0 to 5. The java program kickoff respective operation once number is entered between 0 to 5. However i want to always enter "1" and write another shell program wrapper to start... (4 Replies)
Discussion started by: surya5kn
4 Replies

4. Shell Programming and Scripting

The scope of the shell/perl script is to read the input text file. Validate the expiry date of each

The scope of the shell/perl script is to read the input text file. Validate the expiry date of each certificate and send the mail to the user. The user takes action to add the new certificate to the storage file and user owns the responsibility to update the input text file with the new certificate... (5 Replies)
Discussion started by: casmo
5 Replies

5. Shell Programming and Scripting

generate tabular output from an input text file in unix shell scripting

Hi, I have the output (as below) which i want it to be in a table. For e.g. space utilization in PSE on path /logs is 0% space utilization in PSE on path /logs/tuxedo/tuxlsp is 16% space utilization in PSE on path /ldvarlsp/lsp/log is 37% space utilization in PSE on path /home is 6%... (7 Replies)
Discussion started by: pkbond
7 Replies

6. Shell Programming and Scripting

shell script to take input from a text file and perform check on each servers and copy files

HI all, I want to script where all the server names will be in a text file like server1 server2 server3 . and the script should take servernames from a text file and perform copy of files if the files are not present on those servers.after which it should take next servername till the end of... (0 Replies)
Discussion started by: joseph.dmello
0 Replies

7. Shell Programming and Scripting

How to redirect a input of find command into a text file

Hello friends, I want a command to print the reult files from find command into a text file.:) Iam looking from forum memebers. PLZ help me.ASAP Thanks in Advance, Siva Ranganath CH (5 Replies)
Discussion started by: sivaranga001
5 Replies

8. Shell Programming and Scripting

how to use data in unix text file as input to an sql query from shell

Hi, I have data in my text file something like this. adams robert ahmed gibbs I want to use this data line by line as input to an sql query which i run by connecting to an oracle database from shell. If you have code for similar scenario , please ehlp. I want the output of the sql query... (7 Replies)
Discussion started by: rdhanek
7 Replies

9. Shell Programming and Scripting

Using the Finger command in a Script

This is my senario..... The user enters a userid into linux. ((I have have already scripted the command to read this userid.)) I need help in writing the script so It reads the userID and in conjuction w/ the finger command displays to the user "no plan" on the screen (so the user reads/sees... (4 Replies)
Discussion started by: apolishuk
4 Replies

10. UNIX for Dummies Questions & Answers

redirecting username to finger

Hi, I have a file named 'uname' that contains just an username and try to redirect the content of the file to finger: $cat uname | finger But finger always shows info for all users, instead of just the one I have in the file. I would appreciate any help. Thanks, David (2 Replies)
Discussion started by: dhinojosa
2 Replies
Login or Register to Ask a Question