Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

egrep

Status
Not open for further replies.

simanek

Programmer
Jan 19, 2001
137
US
Hi all,

I've been working on a simple egrep expression for about a day now and i'm hoping someone will have some more insight to it than I do. Basically, what I want my egrep expression to do is return the first letter of an environment variable called $NAME, which is actually an echo of 'whoami'. I would think that egrep ^. $NAME would work...but noooooooo. Any ideas out there? Thanks. Mike
~~~~
simanek@uiuc.edu
"It's a Swingline!"
~~~~
 
Hi,
Why use egrep when u can use just the cut command....
whoami|cut -c 1
or
echo $NAME|cut -c 1
will give u the desired output....
 
Are you writing this egrep in script or is it a program written in c? If it is written in c, try using
getevn("LOGNAME")it will return the name of the user logged in. Then use a pointer to point to the first letter of the name.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top