473,382 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Reading a line at a time from a file

bjg
Hey,

Just wondering what the best way to do this is?

What i specifically want to do is check if a user exists on a unix machine.
The best way i was told was to read a line at a time of /etc/passwd and
check if the username is in that line.

Cheers
Jul 17 '05 #1
2 2106
RG

"bjg" <bjg_at_internode.on.net> wrote in message
news:3f********@duster.adelaide.on.net...
Hey,

Just wondering what the best way to do this is?

What i specifically want to do is check if a user exists on a unix machine. The best way i was told was to read a line at a time of /etc/passwd and
check if the username is in that line.

Cheers

see file();
RG
Jul 17 '05 #2
An noise sounding like bjg said:
Hey,

Just wondering what the best way to do this is?

What i specifically want to do is check if a user exists on a unix machine.
The best way i was told was to read a line at a time of /etc/passwd and
check if the username is in that line.

system("grep <username> /etc/password") and process the result. Probably a
whole hella lot quicker on system with a large number of users and reading in
and having php parse and search the whole file.

Dave
--

I'm a dead man, and buggered to boot!

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Uri | last post by:
I have a file that looks like this: (but longer, no wordwrap) Name: Date: Time: Company: Employee Number: Jim 2.03.04 12:00 JimEnt 4 Steve 3.04.32 ...
4
by: Marty | last post by:
Hi everybody, Is it possible to do that in VB.NET: I have a text file that is filled with new lines of text every n seconds. This text file get very massive. I want to have my program to...
7
by: jamait | last post by:
Hi all, I m trying to read in a text file into a datatable... Not sure on how to split up the information though, regex or substrings...? sample: Col1 Col2 ...
2
by: Roland Hall | last post by:
I have two(2) issues. I'm experiencing a little difficulty and having to resort to a work around. I already found one bug, although stated the bug was only in ODBC, which I'm not using. It...
3
by: SB | last post by:
Hello. I have an input file which is laid out in the following manner... Name Day 1 am time 1 am time 2 appointment pm time 1 pm time 2 appointment Day 2
1
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but...
6
by: KevinD | last post by:
assumption: I am new to C and old to COBOL I have been reading a lot (self teaching) but something is not sinking in with respect to reading a simple file - one record at a time. Using C, I am...
40
by: googler | last post by:
I'm trying to read from an input text file and print it out. I can do this by reading each character, but I want to implement it in a more efficient way. So I thought my program should read one...
2
by: friend.blah | last post by:
i have a text file lets say in this format abc abs ajfhg agjfh fhs ghg jhgjs fjhg dj djk djghd dkfdf .... .... ...... i want to read the first line at certain time for eg : at 10clk
3
by: xyz | last post by:
Hi, I have a text file around 7GB includes 100 million lines... I want to read the data line by line when I approach my module.. ie., when i read for the first time , my program shuld read only...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.