LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-01-2003, 12:45 AM   #1
eggoz
Member
 
Registered: Feb 2003
Posts: 159

Rep: Reputation: 30
Getting last line


How can I get the last line of a file? I need to sort the user ids by number order and store them in a file. (awk -F: '{ print $3 }' /etc/passwd | sort -n -u > /etc/TMPFILE). What command can I use to see the last uid? Thanks.

Since I'm here... I need to write a script to add a new user. My idea is breaking it down. Prompt for username, give it a userid, groupid, home dir, etc. storing each as a variable. At the end, it takes each varible adds in :'s and pastes it at the end of the passwd file. How would you go about this? I am not looking for a script, just ideas.
 
Old 04-01-2003, 01:13 AM   #2
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Rep: Reputation: 30
tail -1 ?
 
  


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
bash shell script read file line by line. Darren[UoW] Programming 57 04-17-2016 06:07 PM
BASH: read every line in the files and use the line as parameters as another program tam3c36 Programming 10 12-07-2010 01:42 PM
C++ text file line by line/each line to string/array Dimitris Programming 15 03-11-2008 08:22 AM
ADSL Router line 1 Mandrake 10. Line 2 is win xp pro virtthemaest Linux - Networking 0 08-05-2004 12:35 AM
linux scripting help needed read from file line by line exc commands each line read atokad Programming 4 12-26-2003 10:24 PM


All times are GMT -5. The time now is 12:06 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