![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read the file line by line | kittusri9 | Shell Programming and Scripting | 3 | 04-24-2008 05:26 AM |
| Read file then grep the line | mr_bold | Shell Programming and Scripting | 2 | 02-06-2008 11:33 PM |
| How to read last line of a txt file? | yongho | UNIX for Dummies Questions & Answers | 2 | 06-13-2005 10:20 AM |
| Read a file line by line | VENC22 | UNIX for Dummies Questions & Answers | 2 | 05-12-2005 10:13 AM |
| read line from file | rein | Shell Programming and Scripting | 5 | 04-14-2005 11:32 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
How to read from a file line by line and do stuff
I want to read from a file and then do some stuff based on the text read from each line. Basically it is a list of usernames and I need to read each user, check it exist in passwd and extract their home directory and then copy a few files to that users home directory. Then move onto the next user in the file. Is this possible ??
|
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
Code:
{
typeset IFS='
'
while read USER_NAME
do
USER_DIR=$(grep $USER_NAME /etc/passwd | awk -F: '{print $6}')
print $USER_DIR
done < /etc/passwd
}
|