For the life of me, I can't find a grep command that can do this.
I want to pipe the usernames that is in the passwd file to a text
file. Can grep do that for me.
doggy
I want to pipe the usernames that is in the passwd file to a text
file. Can grep do that for me.
doggy
getent passwd | awk -F: '{print $1}'
is one way to do it.
hth
t
> I want to pipe the usernames that is in the passwd file to a text
> file. Can grep do that for me.
awk -F: '{print $1}' /etc/passwd > filename
Peace,
Petr
cut -d: -f1 < /etc/passwd > textfileQuote:> For the life of me, I can't find a grep command that can do this.
> I want to pipe the usernames that is in the passwd file to a text
> file. Can grep do that for me.
> doggy
--
Andreas K?h?ri
--------------------------------------------------------------
Stable, secure, clean, free: www.netbsd.org
>> For the life of me, I can't find a grep command that can do this.
>> I want to pipe the usernames that is in the passwd file to a text
>> file. Can grep do that for me.
> You want awk. Man awk.
Shorter with cut.Quote:> awk -F: '{print $1}' /etc/passwd > filename
--
Andreas K?h?ri
--------------------------------------------------------------
Stable, secure, clean, free: www.netbsd.org
>> I want to pipe the usernames that is in the passwd file to a text
>> file. Can grep do that for me.
>> doggy
>cut -d: -f1 < /etc/passwd > textfile
User Commands cut(1)
NAME
cut - cut out selected fields of each line of a file
SYNOPSIS
cut -b list [ -n ] [ file ... ]
cut -c list [ file ... ]
cut -f list [ -d delim ] [ -s ] [ file ... ]
>>Submitted by "Doggy" to comp.unix.admin:
>>> For the life of me, I can't find a grep command that can do this.
>>> I want to pipe the usernames that is in the passwd file to a text
>>> file. Can grep do that for me.
>>> doggy
>>cut -d: -f1 < /etc/passwd > textfile
> The "<", here is superfluous and misleading, viz:
How about this instead:
cat /etc/passwd | cut -d: -f1 > usernames.txt
>>> For the life of me, I can't find a grep command that can do this.
>>> I want to pipe the usernames that is in the passwd file to a text
>>> file. Can grep do that for me.
>> You want awk. Man awk.
> I read that as "You want awk, man. awk."
>> awk -F: '{print $1}' /etc/passwd > filename
> Shorter with cut.
-----.
--
"Hell, rocket science isn't even rocket science"
--A NASA rocket scientist, undernet, circa 1996
1. grep sTerm * | grep -v grep ???
in .bashrc
alias r='ps ax | grep $1 | grep -v grep'
this works from the command line but doesn't work from the bashrc.
Apparently there's a syntax problem.
...and
. filename
where can I read about this commad that is found in bash and sh
scripts? I searched the bash and one or two other man pgs to no
avail. Thanks gurus.
--
5. PLEASE HELP A NEWBIE: grep doesn't grep
6. Race in fs/proc/generic.c:make_inode_n
8. How to perform simple tcp port mapping?
9. Help! need an 'exclude' grep
10. Grep bug? Help in double-checking needed.
12. grep,egrep,fgrep help needed
13. Need help on using find + grep