04-07-2008
how to use sed to sort out this question
root:x:0:0:0000-Admin(0000):/:/sbin/sh
rootcsh:x:0:1:0000-Admin(0000):/:/bin/csh
nocol:x:6312:630:NOCOL Monitor,,,:/usr/local/lib/nocol-client:/usr/local/bin/bash
nobody:x:60001:60001:uid no body:/:/usr/local/bin/bash
noaccess:x:60002:60002:uid no access:/:/usr/local/bin/bash
nobody4:x:65534:65534:SunOS 4.x NFS Anonymous Access User:/:/usr/local/bin/bash
+@c_staff::::::
+::::::/usr/local/sbin/nologin
all above content are in a file called passwd.txt
username:password:uid:gid:gcos-field:home-dir:login-shell
(i)write a shell script and make above output the fields:username,shell,home directory
(ii)and also removes all the lines which start with a '+'
Last edited by sonicstage; 04-07-2008 at 04:43 AM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
M 47 HIS:LOT 32 DUTY 2 MIKE, FINISHED
MIKE ACTIVE STATUS
23TASK YES GOOD
100TASK NO GOOD
========================================
M 47 HIS:LOT 1 DUTY 1 MIKE, FINISHED
MIKE ACTIVE STATUS
23TASK YES GOOD
... (7 Replies)
Discussion started by: bobo
7 Replies
2. UNIX for Dummies Questions & Answers
Hello all,
I have a test file that has the format:
.....
O
3.694950 -.895050 1.480000
O
5.485050 .895050 1.480000
Ti
-4.590000 4.590000 2.960000
Ti
-2.295000 ... (5 Replies)
Discussion started by: aarondesk
5 Replies
3. UNIX for Dummies Questions & Answers
I'm looking for a sort command that will sort by zip code first then by last name. (zip code is the last field, last name is first field)
data file looks like this.
Hope Bob 1234 Main ST. Colorado Springs, CO 80920
I was thinking along the lines of:
sort -k9n address.data //for the... (2 Replies)
Discussion started by: ssgatbliss
2 Replies
4. Shell Programming and Scripting
Hi All,
I have a small problem, hope you can help me out here.
I have a file that contains the same format of lines in 99% of the cases.
906516 XYZ.NNN V 0000 20070711164648 userID1 userID2 hostname 20070711164641
There are unfortunately several lines with these... (5 Replies)
Discussion started by: BearCheese
5 Replies
5. Shell Programming and Scripting
Hi all.
Is there a way that I can use the sort command too sort the following field by earliest time (12:00AM) to latest time (11:59PM)?
07:12PM
07:53PM
07:54PM
08:07PM
10:15AM
10:21AM
TIA!!!!!! (1 Reply)
Discussion started by: lyoncc
1 Replies
6. Shell Programming and Scripting
Hi all.
HPUX - posix shell - script question
Here's my data:
f1 f2 f3 f4 f5 f6
|02/12/09|12:33PM|3|Oceanview |OVT #1| VISA/MC
|02/12/09|12:14PM|3|Oceanview |OVT #1| VISA/MC
|02/12/09|09:13AM|4|Oceanview |OVT #1| VISA/MC ... (8 Replies)
Discussion started by: lyoncc
8 Replies
7. Shell Programming and Scripting
Hi Guys,
I have a file to be sorted and uniq with the following format.
S00001002|01|20021231
S00001002|01|20011031
S00001006|01|20120430
S00001006|01|20111231
S00001006|01|20111031
S00001006|01|20110831
S00001006|01|20110731
S00001006|01|20101231
S00001006|01|20091231... (5 Replies)
Discussion started by: nua7
5 Replies
8. UNIX for Dummies Questions & Answers
I have a file like this:
/vol/eng_app_0103z
/vol/eng_app_0103z
/vol/eng_app_0120z
/vol/eng_app_0126z
/vol/eng_app_0144z
/vol/eng_app_0150z
/vol/eng_app_0154z
/vol/eng_app_01551z
/vol/eng_app_01552z
/vol/eng_app_0155z
/vol/eng_app_0164z
/vol/eng_app_0199zWhen I use the sort command... (3 Replies)
Discussion started by: newbie2010
3 Replies
9. Shell Programming and Scripting
I have a question about what the sort command is doing.
Here is some sample data:
348201310013RVE 2
600201310013GFJ 70
3302013020101NS 40
600201309013GFJ 70
The sort command that is running is as follows:
sort -k 1,3 -k 12,4 input.txt > output.txt
... (6 Replies)
Discussion started by: Drenhead
6 Replies
10. UNIX for Beginners Questions & Answers
Have a text file containing 4 columns, the 4th column is sorted numerically in descending order. The 2nd column is alpha text. Been able to get the 4th column to sort in descending order. The 2nd column sorts correctly but it's also in reverse. Would like to be able to keep the 4th column sort... (8 Replies)
Discussion started by: jimmyf
8 Replies
Foreign(4) Kernel Interfaces Manual Foreign(4)
NAME
Foreign - Logs contact attempts from unknown systems
SYNOPSIS
/usr/lib/uucp/.Admin/Foreign
DESCRIPTION
The /usr/lib/uucp/.Admin/Foreign file lists access attempts by unknown systems. The /usr/lib/uucp/remote.unknown shell script appends an
entry to the Foreign file each time a remote computer that is not listed in the local /usr/lib/uucp/Systems file attempts to communicate
with that local system.
Someone with superuser authority can customize entries in the Foreign file to fit the needs of a specific site by modifying the
remote.unknown shell script.
EXAMPLES
The following is a sample entry in the Foreign file:
Wed Sep 20 20:38:22 CDT 1989: call from the system merlin
System merlin, which is not listed in the /usr/lib/uucp/Systems file, attempted to log in on September 20 at 10:38 p.m., but the uucp pro-
gram did not allow the unknown system to log in.
FILES
Describes access permissions for remote systems Describes accessible remote systems Records contacts from unknown systems in the Foreign
file Contains the Foreign file and other uucp administrative files
RELATED INFORMATION
Commands: uucp(1), uudemon.cleanu(4), uux(1)
Daemons: cron(8), uucico(8), uuxqt(1) delim off
Foreign(4)