Results 1 to 4 of 4
Hi there, I'm new to linux programming. I've read a similar post about my problem but the solution given by the other members is using awk command. I have to ...
- 10-06-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 8
How to create table without awk command ?
Hi there, I'm new to linux programming. I've read a similar post about my problem but the solution given by the other members is using awk command. I have to solve the same problem without using awk commands. Anybody can help me with the sed commands if I'm not mistaken will do the same thing ?
Question: I need to create a table out from /etc/passwd file with following format:-
User Name User User Group ID Home
--------------- ------- --------------- -----------
John 234 23 /home/john
Any kind soul out there can help me ? Thanks a lot.
- 10-06-2007 #2Code:
{ printf "%-20s\t%s\t%s\t%s\n" "UserName" "UserID" "GroupID" "Home" while IFS=: read -r un p uid gid j h s;do printf "%-20s\t%d\t%d\t%s\n" "$un" "$uid" "$gid" "$h" done</etc/passwd;}
- 10-06-2007 #3Just Joined!
- Join Date
- Oct 2007
- Posts
- 8
thanks a lot radoulov, that was a quick reply! my problem is solved.
- 10-06-2007 #4forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,095
Sorry but it's against the forum rules to post homework/classwork questions:
http://www.linuxforums.org/forum/lin...ums-rules.html
oz
→ new members/users: read this first | new member faq
→ no private messages requesting computer support - post them on the forums!
→ please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.


